CODE BOX
Pages
Home
Data Types
Algorithms
Easy Find
Linux Commands
Monday 21 September 2015
WAP to input a number through the keyboard until a ‘.’ Every time a number is entered. The program should display whether it is greater than, less than or equal to the previous number.
Code : :
#include<stdio.h>
int main()
{
int num,a;
scanf("%d",&a);
while(scanf("%d",&num))
{
if(num == '.') break;
else if(num>a)
printf("Grater\n");
else if(num<a)
printf("Less\n");
else if(num==a)
printf("Equal\n");
a=num;
}
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment