TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

C Program to convert Number in Characters

C Program to convert Number in Characters in C with programming examples for beginners and professionals covering concepts, control statements, c array, c pointers, c structures, c union, c strings and more.

<< Back to C

C Program to convert Number in Characters

Number in characters conversion: In c language, we can easily convert number in characters by the help of loop and switch case. In this program, we are taking input from the user and iterating this number until it is 0. While iteration, we are dividing it by 10 and the remainder is passed in switch case to get the word for the number.

Let's see the c program to convert number in characters.

#include  
#include
int main(){
long int n,sum=0,r;  
system("cls");
printf("enter the number=");  
scanf("%ld",&n);  
while(n>0)  
{  
r=n%10;  
sum=sum*10+r;  
n=n/10;  
}  
n=sum;  
while(n>0)  
{  
r=n%10;  
switch(r)  
{  
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;  
case 0:  
printf("zero ");  
break;  
default:  
printf("tttt");  
break;  
}  
n=n/10;  
}  
return 0;
}

Output:

enter the number=4321
four three two one  



Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf