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

Posted By: Ella Brown     Category: C Programming     Views: 18624

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 in C Programming







   NAME:NAYAN SHAH

   ROLL NO: 48

   SEMISTER: 1

   DEFINATION:  40. Write a program that accepts a stringin an array and
        prints the reverse of the string i.e. if the stringis
        abcd then it will print dcba.

--------------------------------------------------------------------------


#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 : SYNTAX    


XATNYS

--------------------------------------------------------------------------
  
Share: 



Ella Brown
Ella Brown author of Program that accepts a string in an array and prints the reverse of the string is from London, United Kingdom.
 
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!