ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
palindrome for strings and numbers----Can anybody do the 
prog?
 Question Submitted By :: Sanglap
I also faced this Question!!     Rank Answer Posted By  
 
  Re: palindrome for strings and numbers----Can anybody do the prog?
Answer
# 1
#include<stdio.h>
#include<conio.h>
void main()
{
 int n,r,temp;
 int s=0;
 clrscr();
 printf("enter the number");
 scanf("%d",&n);
 temp=n;
 while(temp>0)
  {
    r=temp%10;
    s=s*10+r;
    temp=temp/10;
  }
  if(n==temp)
    printf(number is pallindrome");
  else
    printf("not pallindrome");
  getch();
}
 
Is This Answer Correct ?    0 Yes 0 No
Arup Bhattacharya
 
  Re: palindrome for strings and numbers----Can anybody do the prog?
Answer
# 2
/*some corrections to above solution*/
#include<stdio.h>
#include<conio.h>
void main()
{
 int n,r,temp;
 int s=0;
 
 printf("enter the number");
 scanf("%d",&n);
 temp=n;
 while(temp>0)
  {
    r=temp%10;
    s=s*10+r;
    temp=temp/10;
  }
  if(n==s)
    printf("number is pallindrome");
  else
    printf("not pallindrome");
  getch();
}
 
Is This Answer Correct ?    0 Yes 0 No
Subbu
 
 
 
  Re: palindrome for strings and numbers----Can anybody do the prog?
Answer
# 3
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[20],b[20];
int i;
clrscr();
printf("\n Enter the Number or String to find Palindrome");
scanf("%s",a);
strcpy(b,a);
strrev(a);
if(strcmp(a,b)==0)
{
printf("\n Entered data is Palindrome\n");
}
else
{
printf("\n Entered data is not a Palindrome\n");
}
getch();
}
 
Is This Answer Correct ?    0 Yes 0 No
Harish
 
  Re: palindrome for strings and numbers----Can anybody do the prog?
Answer
# 4
//the palindrome for string can also be written as below, 
without using inbuilt functions.

void main()
{
char str[10];
int flag = 0;
int i , j;

puts("ENTER THE STRING");
fflush(stdin);
gets(str);


for(i = 0 ; str[i] != '\0' ; i++);
i--;

for(j = 0 ; j<i ; j++ , i--)
{
  if(str[j] == str[i])
    flag = 1;
  else
  {
     flag = 0;
     break;
  }
}

if(flag == 1)
  puts("STRING IS A PALINDROME");
else
  puts("STRING IS NOT A PALINDROME");
}
 
Is This Answer Correct ?    1 Yes 0 No
Shruti
 
  Re: palindrome for strings and numbers----Can anybody do the prog?
Answer
# 5
#include<stdio.h>
void main
{
int n,t,d,r;
printf("Enter the number:");
scanf("%d",&n);
t=n;
while(n>=1)
{
d=n%10;
r=(r*10)+d;
n=n/10;
}
if(t==r)
printf("Palindrome");
else
printf("Not a palindrome");
}
 
Is This Answer Correct ?    0 Yes 0 No
Sree
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Study the Following Points: a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static 1. Which of the Following Statements are true w.r.t Bit- Fields A)a,b&c B)Only a & b C)Only c D)All Accenture1
write a program to find out number of on bits in a number? Huawei11
What is the output for the following program #include<stdio.h> main() { char a[5][5],flag; a[0][0]='A'; flag=((a==*a)&&(*a==a[0])); printf("%d\n",flag); } ADITI3
Write code for initializing one dimentional and two dimentional array in a C Program? Deshaw5
biggest of two no's with out using if condition statement  2
Can we write a program without main() function?  6
Can we access RAM? How? Whats the range of access? Similarly What are other hardware we can access?  1
Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc  1
write a fuction for accepting and replacing lowercase letter to'Z' with out using inline function. Temenos3
WAP to accept first name,middle name & last name of a student display its initials? NIIT1
i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }  2
post new interiew question and aptitude test papers  1
Which is not valid in C? 1) class aClass{public:int x;} 2) /* A comment */ 3) char x=12;  4
How to calculate Total working time using Login and logout? Wipro2
WHY DO WE USE A TERMINATOR IN C LANGUAGE?  2
Design a program using an array that lists even numbers and odd numbers separately from the 12 numbers supplied by a user.  4
Software Interview Questions CAT1
write a C program to print the program itself ?! TCS6
why i join syntel? Syntel11
1.find the second maximum in an array? 2.how do you create hash table in c? 3.what is hash collision Qualcomm3
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com