//program to input your name and address and to display them 40 times.
#include<stdio.h>
#include<conio.h>
void main()
{
char name[40],address[40];
int k=0;printf("enter your name\n");
gets(name);
printf("enter your address");
gets(address);
while(k<=40)
{
puts(name);
puts(address);
k++;
}
getch();
}
note:
1)
you can also use printf( ) instead 'puts'.(without single quote) and scanf("%^[\n]",name) instead 'gets' function.
2)
If you want to display 'n' number of times then enter value of 'n' with its declaration.
#include<stdio.h>
#include<conio.h>
void main()
{
char name[40],address[40];
int k=0;printf("enter your name\n");
gets(name);
printf("enter your address");
gets(address);
while(k<=40)
{
puts(name);
puts(address);
k++;
}
getch();
}
note:
1)
you can also use printf( ) instead 'puts'.(without single quote) and scanf("%^[\n]",name) instead 'gets' function.
2)
If you want to display 'n' number of times then enter value of 'n' with its declaration.