pallindrome

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deepakwasake
    New Member
    • Oct 2006
    • 4

    pallindrome

    tel me program for pallindrome?
  • RADAR
    New Member
    • Oct 2006
    • 21

    #2
    //IN C[COMPILER VISUAL STUDIO 6,0]
    #include <stdio.h>
    #include <conio.h>
    int main(void)
    {
    int input1,output1;
    int digit1,digit2,d igit3;
    do
    {
    printf("Enter three digit integer:");
    scanf("%d",&inp ut1);
    }
    while((input1<1 00)||(input1>99 9));
    digit1=input1%1 0;
    input1/=10;
    digit2=input1%1 0;
    input1/=10;
    digit3=input1%1 0;
    digit1*=100;
    digit2*=10;
    digit3*=1;
    output1=digit1+ digit2+digit3;
    printf("\nThe pallindrome is %d",output1);
    getch();
    return 0;
    }

    /*HINT:for more digits ex:4 digits
    use while((input<10 00)||(input>999 9));*/

    Comment

    • sowmyth
      New Member
      • Oct 2006
      • 19

      #3
      #include<stdio. h>
      main(){
      int n,d,p;
      int r=0;
      printf("enter a number");
      scanf("%d",&n);
      p=n;
      while(n>0){
      d=n%10;
      r=r*10+d;
      n=n/10;
      }
      if(r=p)
      printf("it is a palindrome");
      else
      printf("it is not a palindrome");
      }

      Comment

      Working...