C program for Enter and display string using getchar and putchar

Thursday, 6 March 2014

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char nandan[20];
char c;
int i,n;
clrscr();
printf("Developed By: Nandan Kr. Kushwaha\n\n");
printf("Enter the size of the string\n");
scanf("%d",&n);
printf("Enter the string\n");
for(i=0;i<=n;i++);
{
c=getchar();
nandan[i]=c;
}
printf("\n String is:");
for(i=0;i<=n;i++)
{
putchar(nandan[i]);
}
getch();
}

OUTPUT:-



No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Related Posts Plugin for WordPress, Blogger...
 

Most Reading

Labels