[ create a new paste ] login | about

Link: http://codepad.org/8p4FI6uQ    [ raw code | output | fork ]

muffinman007 - C, pasted on Nov 16:
#include<stdio.h>

int main(void){

    int palindrome;
    char again;

    printf("Enter a 5 digit integers: ");
    scanf("%d", &palindrome);
        if ( ((palindrome/10000) % (palindrome % 10)) == 0){
            if( (  ((palindrome % 10000)/1000) % ((palindrome % 100)/10)  ) == 0){
                printf("The digit %d is a palindrome number.\n", palindrome);
            } else {
                printf("The digit %d is not a palindrome number.\n", palindrome);
            }
          } else {
            printf("The digit %d is not a palindrome number.\n", palindrome);
        }

    printf("Would you like to try again? (y or n): ");
    scanf("%c", &again);

    while (again != 'n'){

    printf("\n\nEnter a 5 digit integers: ");
    scanf("%d", &palindrome);
        if ( ((palindrome/10000) % (palindrome % 10)) == 0){
            if( (  ((palindrome % 10000)/1000) % ((palindrome % 100)/10)  ) == 0){
                printf("The digit %d is a palindrome number.\n", palindrome);
            } else {
                printf("The digit %d is not a palindrome number.\n", palindrome);
            }
          } else {
            printf("The digit %d is not a palindrome number.\n", palindrome);
        }

    printf("Would you like to try again? (y or n): ");
    scanf("%c", &again);


    }


    return 0;
}


Output:
1
Floating point exception


Create a new paste based on this one


Comments: