Sunday 8 April 2012

19.Program to Accept a String and display in Reverse

#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<string.h>
#define MAX 80
void main()
{  int length;
   clrscr() ;
   char string1[MAX+1] ;
   puts("Enter the string \n");
   gets(string1);
   puts(string1);
   length=strlen(string1);
   cout<<"Length of string is "<<length<<"\n";
   for(int i=length-1; i>=0;i--)
   {
     cout<<string1[i];
   }


   getch();

}

No comments:

Post a Comment

Write a program which reads a set of integers into an integer array and then prints "YES"if all of them are same otherwise print "NO".

#include<stdio.h> int main() { int a[10],M=0,i,n; printf("enter a value for n\n"); scanf("%d",&n); fo...