Advance Programs On For LoopLearn C ProgrammingLearn ProgrammingLoop Control StructuresPrograms On Case Control StructureResources

057. Write a program to accept a single value interger from user and print that integer in words in C language

By September 18, 2012 September 5th, 2018 No Comments
  1. #include<stdio.h>
  2. #include<conio.h>
  3. main()
  4. {
  5. int n;
  6. clrscr();
  7. printf("Enter number...");
  8. scanf("%1d",&n); //%1d to scan single integer
  9. switch(n)
  10. {
  11. case 0 : printf("Zero");break;
  12. case 1 : printf("One");break;
  13. case 2 : printf("Two");break;
  14. case 3 : printf("Three");break;
  15. case 4 : printf("Four");break;
  16. case 5 : printf("Five");break;
  17. case 6 : printf("Six");break;
  18. case 7 : printf("Seven ");break;
  19. case 8 : printf("Eigth ");break;
  20. case 9 : printf("Nine ");break;
  21. }
  22. getch();
  23. }
#include<stdio.h>
#include<conio.h>  
main()
{
	int n;
	clrscr();
	printf("Enter number...");
	scanf("%1d",&n);  //%1d to scan single integer
	switch(n)
	{
		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("Eigth ");break;
		case 9 : printf("Nine ");break;
	}
	getch();
}

Leave a Reply

DEMO01