Pages

Monday, 21 May 2012

rogram to print the reverse number


99./*Write a program to print the reverse number*/

#include<stdio.h>
#include<conio.h>
main()
{
char str1[10];
int i,len=0,j;
clrscr();
printf("Enter the string:");
gets(str1);
for(i=0;str1[i]!='\0';i++)
{
len++;
}
printf("\n The reverse string is:");
for(j=len-1;j>=0;j--)
{
printf("%c",str1[j]);
}
getch();
}

OUTPUT
            Enter the string :MAHESH
            The reverse string is : HSWHAM

No comments:

Post a Comment