Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Comment



Iterative statement



Working with switch case



Header file



Specifer




String_ given string is palindrome or not




// AHF C PROGRAM SOLVING

//solving here 2_D   ARRAY 	programming problem

#include #include #define pf printf int main() { char str[20]; int i,length,flag = 0; pf("Enter a string:"); scanf("%s", str); //counting string length length = strlen(str); //checking for palindrome for(i=0;i < length ;i++) { if(str[i] != str[length-i-1]) { flag = 1; break; } } //showing palindrome result if (flag) pf("%s is not a palindrome", str); else pf("%s is a palindrome", str); return 0; }
OUTPUT:


© 2018 - All rights reserved