BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/300-object-oriented-programming/)
-   -   Program to enter an integer and print if it is greater or less than 100 (http://bzupages.com/f300/program-enter-integer-print-if-greater-less-than-100-a-14554/)

bonfire 01-03-2011 02:28 PM

Program to enter an integer and print if it is greater or less than 100
 
1 Attachment(s)
Program to enter an integer and print if it is greater or less than 100

#include
#include

void main(){
clrscr();
int x;
cout << "Enter an integer : " << endl;
cin>>x;
if(x>100)
{
cout << x << " is greater than 100." << endl;
}
else
{
cout << x << " is less than 100." << endl;
}
getch();
}
This program takes in an integer x as a screen input from the user.
The program tells the user whether that integer is greater than 100 or less than 100.
It then prints out the appropriate message using the 'cout' command.

Sample Input
74
Sample Output
74 is less than 100.


All times are GMT +5. The time now is 01:55 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.