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 three integers and output the smallest integer using IF (http://bzupages.com/f300/program-enter-three-integers-output-smallest-integer-using-if-14671/)

bonfire 09-03-2011 12:28 AM

Program to enter three integers and output the smallest integer using IF
 
1 Attachment(s)
Program to enter three integers and output the smallest integer using IF


#include
#include
int main()
{
clrscr();
int x,y,z,smallest;
cout << "Enter 3 integers : ";
cin>>x>>y>>z;
smallest=x;
if(y smallest=y;
if(z smallest=z;
cout << "The smallest integer out of the 3 integers you typed ";
cout << x << ", " << y << " & " << z << " is : " << "\n" << smallest << "\n";
getch();
return 0;
}
This program takes in three integers x, y and z as a screen input from the user.
It then determines thesmallest integer of the three and prints it out using the 'cout' command.



Sample Input
82 78 86

Sample Output
The smallest integer out of the 3 integers you typed 82, 78 & 86 is :
78


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

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