#include <iostream>

std::string spell[] = {"zero","one","two","three","four","five","six","seven","eight","nine","ten"};

void printn(int n){
    if(n==0){
        return;
    }

    int ld = n%10; //ld = 9876 % 10 gives 6//ld = 987 % 10 gives 7// Get the last digit of n
    printn(n/10); //printn(9876 / 10)
    std::cout<<spell[ld];
}

int main() {
    int n;
    std::cin>>n;

    printn(n);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: