C Basics Programs 1.Check a string is a palindrome or not? Program:- #include<stdio.h> #include<string.h> void isPalindrome(char *str) { int i,l,h; l=strlen(str); i=0; h=l-1; while(h>i) { if(str[i++]!=str[h--]) { printf("Not Palindrome"); return; } } printf("Palindrome"); } int main() { int i,l,flag=0; char str[20]; printf("Enter a string:-"); scanf("%s",str); isPalindrome(str); return 0; } Output :- Enter a string:- abcdcba Palindrome 2.Find the maximum frquency of a character in a string. Program:- #include<stdio.h> #include<string.h> //#define ASCII_SIZE 256 char string_freq(char *str) { int i,j,l,cmax=0,count; char s; l=strlen(str); for(i=0;i<l;i++) { count=1; for(j=i+1;j<l;j++) { if(str[i]==str[j]) { count++; } } if(cmax<count) { cmax=count; s=str[i]; } } printf("\n%d",cmax); return s; } in...
The "Programming Beginners" provides the solution of computer programming programs, IT company information for job placement, interviews related questions and interviews experiences. This website is free for anyone from users all over the world. It teaches or publish posts related to the programming languages like C, C++ and Python.