Program to print a user entered character, to user entered number times

//Program to print a user entered character,
//to user entered number times
#include<stdio.h>
#include<conio.h>
int main()
{
  int n;
  char ch;
  clrscr();
  printf("Enter a number\n");
  scanf("%d",&n);
  printf("Enter character");
  fflush(stdin);
  scanf("%c",&ch);
  while(n>0)
  {
    printf("%c",ch);
    n--;
  }

  getch();
  return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

No comments:

Post a Comment