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.
Post a Comment