/*print reverse string*/
#include<stdio.h> //Header file
#include<string.h>
void main()
{
char name[20]; //initialize variable
int len,a;
printf("enter your name");
scanf("%s",&name); //Get string in run time
printf("your name is = %s",name);
printf("\n.......................\n");
len=strlen(name); //find the length of stirng
a=len;
printf("reverse of your name is=");
for(len=a;len>=0;len--) //logic to print reverse stringa
{
printf("%c",name[len]);
} //End of for loop
}//End of main
No comments:
Post a Comment