Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

that asks for a two digit number and then prints the english word for the number

#include <stdio.h>

int main(void)
{
    int first_digit, second_digit;

    printf("Enter two digits: ");
    scanf("%1d%1d",&first_digit,&second_digit);

    if (first_digit == 1) {
        switch(second_digit % 10) {
            case 0: printf(" ten"); break;
            case 1: printf(" eleven"); break;
            case 2: printf(" twelve"); break;
            case 3: printf(" thirteen"); break;
            case 4: printf(" fourteen"); break;
            case 5: printf(" fifteen"); break;
            case 6: printf(" sixteen"); break;
            case 7: printf(" seventeen"); break;
            case 8: printf(" eighteen"); break;
            case 9: printf(" ninteen"); break;
        }
        return 0;
    }
    switch(first_digit % 10) {
        case 1: printf("ten"); break;
        case 2: printf("twenty"); break;
        case 3: printf("thirty"); break;
        case 4: printf("forty"); break;
        case 5: printf("fifty"); break;
        case 6: printf("sixty"); break;
        case 7: printf("seventy"); break;
        case 8: printf("eighty"); break;
        case 9: printf("ninety"); break;
    }
    switch(second_digit % 10) {
        case 0: 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;
    }
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: There are 7 components with misconfigured ETags 
Typescript :: typescript reset class properties to default 
Typescript :: Give an O (n lg k)-time algorithm to merge k sorted lists into one sorted list 
Typescript :: sourcetree winmerge arguments three way merge 
Typescript :: ts Template pattern 
Typescript :: components of .net framework 
Typescript :: java objects cannot change? 
Typescript :: struts 2 form tags 
Typescript :: change css to scss in angular online 
Typescript :: why are my fonts and logo not appearing before I sign in asp.net 
Typescript :: description of capillary walls 
Typescript :: google sheets past tsv data 
Typescript :: components of selenium 
Typescript :: regexp in typescript types 
Typescript :: javascrpit password 
Typescript :: whats a 3rd wheel 
Typescript :: // running tests Your code should no longer have a p tag around the text asking what level ninja a user is. // tests completed category:423 
Cpp :: c++ starter 
Cpp :: c++ get filename from path 
Cpp :: c++ message box error 
Cpp :: c++ find minimum value in vector 
Cpp :: add arbitrum to metamask 
Cpp :: prime number generator c++ 
Cpp :: how to make string get spaces c++ 
Cpp :: grpah class data structure 
Cpp :: get ascii value of qchar 
Cpp :: char type casting in c++ 
Cpp :: delete 2d dynamic array c++ 
Cpp :: taking user input for a vector in c++ 
Cpp :: c++ remove space from string 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =