Saturday, August 20, 2011

Program to enter line using getchar and print it using putchar function.

//Program to enter line using getchar and print it using putchar function.
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,j;
char c[50],ch;
clrscr();
printf("\n Enter the line: ");
while(ch!='\n')
{
 ch=getchar();
 c[i]=ch;
 i++;
}
printf("\n Entered line is :");
for(j=i-1;j>=0;j--)
{
 putchar(c[j]);
}
getch();
}

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More