Thursday, November 14, 2019

Two Digits into Words Translator in C

A simple program that will ask the user to give two digits and translates into words using the C programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My Facebook address is https://www.facebook.com/profile.php?...

My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/

https://www.unlimitedbooksph.com/

Thank you very much for your help and support.



Sample Program Output


Program Listing

#include <stdio.h>  
 
int main()
{
    int num1=0, num2=0;
   
    printf("\n\n");
    printf("\tTwo Digits into Words Translator in C");
    printf("\n\n");
    printf("\tEnter a two-digit number: ");
    scanf("%1d%1d", &num1, &num2);
 
    printf("\tYou have entered: ");
 
  
    switch (num1)
    {
        case 1:
           
            switch (num2)
            {
                case 0:
                    printf("\tten"); 
                    return 0;
                case 1:
                    printf("\televen"); 
                    return 0;
                case 2:
                    printf("\ttwelve"); 
                    return 0;
                case 3:
                    printf("\tthirteen"); 
                    return 0;
                case 4:
                    printf("\tfourteen"); 
                    return 0;
                case 5:
                    printf("\tfifteen"); 
                    return 0;
                case 6:
                    printf("\tsixteen"); 
                    return 0;
                case 7:
                    printf("\tseventeen"); 
                    return 0;
                case 8:
                    printf("\teigthteen"); 
                    return 0;
                case 9:
                    printf("\tnineteen"); 
                    return 0;
            }
        case 2:
            printf("\ttwenty"); 
            break;
        case 3:
            printf("\tthirty"); 
            break;
        case 4:
            printf("\tforty"); 
            break;
        case 5:
            printf("\tfifty"); 
            break;
        case 6:
            printf("\tsixty"); 
            break;
        case 7:
            printf("\tseventy"); 
            break;
        case 8:
            printf("\teighty"); 
            break;
        case 9:
            printf("\tninety"); 
            break;
    }
 
   
    switch (num2)
    {
        case 1:
            printf("\t-one"); 
            break;
        case 2:
            printf("\t-two"); 
            break;
        case 3:
            printf("\t-three"); 
            break;
        case 4:
            printf("\t-four"); 
            break;
        case 5:
            printf("\t-five"); 
            break;
        case 6:
            printf("\t-six"); 
            break;
        case 7:
            printf("\t-seven"); 
            break;
        case 8:
            printf("\t-eight"); 
            break;
        case 9:
            printf("\t-nine"); 
            break;
    }
 
    printf("\n\n");
    printf("\tEnd of Program");
    printf("\n\n");
}

No comments:

Post a Comment