FY_BCA_C_SLIP_26




/* Slip no 26_1: display each digit in words*/

#include<stdio.h>
#include<conio.h>

int main()
{
                int rev=0,no,rem;
                clrscr();
                printf("\n Enter no : ");
                scanf("%d",&no);
                while(no>0)
                {
                                rev=rev*10+no%10;
                                no=no/10;
                }
                printf("\n reverse no is = %d",rev);

                while(rev>0)
                {
                                rem=rev%10;
                                rev=rev/10;
                                switch(rem)
                                {
                                                case 0: printf("Zero ");
                                                                break;
                                                case 1: printf("One ");
                                                                break;
                                                case 2: printf("Two ");
                                                                break;
                                                case 3: printf("Three ");
                                                                break;
                                                case 4: printf("four ");
                                                                break;
                                                case 5: printf("Five ");
                                                                break;
                                                case 6: printf("six ");
                                                                break;
                                                case 7: printf("Seven");
                                                                break;
                                                case 8: printf("Eight ");
                                                                break;
                                                case 9: printf("Nine ");
                                                                break;

                                }
                }
                getch();
}

No comments:

Post a Comment