Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program that accepts a string in an array and prints the reverse of the string i.e. if the string is abcd then it will print dcba.

Posted By: Tim George     Category: C Programming     Views: 2029

Write a program that accepts a string in an array and
prints the reverse of the string i.e. if the string is
abcd then it will print dcba.

Code for Program that accepts a string in an array and prints the reverse of the string i.e. if the string is abcd then it will print dcba. in C Programming

#include<stdio.h>
#include<conio.h>
void main()
{
    char a[50],b[50];
    int i,j,n,totword=1,totchar=0,totline=1;
    clrscr();
    printf("\n Please Give The STRING : ");
    scanf("%s",a);
    for(j=strlen(a)-1;j>=0;j--)
        printf("%c",a[j]);
    getch();
}


**************************** OUTPUT *****************************************

    Please Give The STRING : World

      dlroW

******************************************************************************
  
Share: 



Tim George
Tim George author of Program that accepts a string in an array and prints the reverse of the string i.e. if the string is abcd then it will print dcba. is from Dallas, United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!