Skip to main content

Posts

Showing posts with the label c program print 3d array

Sample C Program to accept a string and print the reverse of the given string.

40) Sample C Program to accept a string and print the reverse of the given string. # include <stdio.h> # include <conio.h> main( ) { int i, j; char name[80]; clrscr( ); printf("Enter a string"); gets(name); for(i = 0; i < 80 && ((name [i] = getchar()) != '\n'); i++);      if(name[i]= ='\n')          name[i]='\0'; for(j=i;j>=0;j--)       putchar(name[j]); printf("Is the reverse of given string"); getch( ); } 41) Sample C Program to accept a string and check whether the given string is palindrome or not. # include <stdio.h> # include <conio.h> main( ) { int i, lim, c, check = 1; char word[80]; clrscr( ); printf("Enter a string"); for(i = 0; i < 80 && ((word [i] = getchar()) != '\n'); i++); lim = i - 1; c = lim / 2; for(i = 0; i <= 0; i++, lim--)      if(word[i] != word[lim])        {     ...