Friday, 21 December 2012
Program to Check Palindrome of a String | C Program
Input
#include<stdio.h>
#include<conio.h>
void main()
{
int i,flag=0;
char a[20],b[20],n; clrscr();
printf("Enter the String to be checked\t");
gets(a);
n=strlen(a);
for(i=0;i<n;i++)
{
b[n-i-1]=a[i];
}
for(i=0;i<n;i++)
{
if(a[i]!=b[i]) { flag=1; break; }
}
if(flag==1) printf("\n String is not palindrome");
if(flag==0) printf("\n String is palindrome");
getch();
}
Turbo C
Program to check Palindrome of a Number | C Program
Input
#include<stdio.h>
#include<conio.h>
void main()
{
int num,rev=0,temp;
clrscr();
printf("Enter the number of want to check for palindrome\n");
scanf("%d",&num);
temp=num;
while(temp>0)
{
rev=(10*rev) + (temp%10);
temp=temp/10;
}
if(num==rev)
printf("\nNumber is Palindrome");
else
printf("\n Number is not Palindrome");
getch();
}
Turbo C
Infotech Enterprises hiring Btech 2012 Passouts
Infotech Enterprises hiring Btech 2012 Passouts
Company:-Infotech Enterprises
Post:-Assistant Design Engineer
Salary:-2.75 to 3 lakhs
Eligibilitiy:-BE/Btech/ME/Mtech
Stream:-Mechanical
Apply now
Subscribe to:
Posts (Atom)



