Friday, May 30, 2014

//WRITE A PROGRAMME TO READ AND PRINT A STRING USING SCANF,PRINTF,GETS,PUTS AND %S FORMAT SPECIFIER

#include<conio.h>
#include<stdio.h>
void main()
{
char s1[20],s2[20];
clrscr();
printf("enter the first string\n");
//use of scanf with %s to read string
scanf("%s",s1);
printf("%s",s1);

printf("enter the second string\n");
//use of gets and puts to read and display string
fflush(stdin);
gets(s2);
puts(s2);

getch();
}

No comments:

Post a Comment