Home » , » Basic C Programming Practice - Practice 7

Basic C Programming Practice - Practice 7

Written By Unknown on Thursday, October 10, 2013 | 11:36 PM

=> Write a program to print alphabetic word form of given number between 0 to 5?



Solution :

#include<stdio.h>
#include<conio.h>
main()
{
      int numb;
      printf("Enter Number In Between 0 - 5 : ");
      scanf("%d",&numb);
      if(numb==0)
      printf("Zero");
      else
      if(numb==1)
      printf("One");
      else
      if(numb==2)
      printf("Two");
      else
      if(numb==3)
      printf("Three");
      else
      if(numb==4)
      printf("Four");
      else
      if(numb==5)
      printf("Five");
      else
      printf("Invalid Input");
      getch();

      }


Program Analysis :
The program writing says if inputted number equal 0 then print ZERO,If inputted number equal 3 then print THREE,If inputted number is grater-than 5 or anything else then print  "Invalid Input"

It is an if else if chain and this program can get input from terminal.                     Best of luck.

Share this article :

Post a Comment

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Learn Programming - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger| Distributed by Rocking Templates