Blogger templates

Pages

Wednesday, 13 June 2012

Write a C Program that Accepts your Name and Prints it Desired Number of Times by using puts() and gets() Statements

C Program

Statement of C Program: This Program accepts your name and prints it for the desired number of times


                                             Did you check the following?


#include<stdio.h>
#include<conio.h>
void main()
{
char name[30];
int mtimes , i ;
printf(" What is your name ?");
gets(name);
printf(" How many times to printf you name ?");
scanf("%d" , &mtimes);
i=0;
while(i<mtimes)
{
puts(name);
i++;
}
}                         /* End of main() */
 
Output:
 What is your name ?
 Rajnikant
 How many times to print your name ?
 4
 Rajnikant
 Rajnikant
 Rajnikant
 Rajnikant


0 comments:

Post a Comment