help required friends
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int n,smallest,smallest2;
cout << "Enter A Number :" << endl;
cin >> n;
smallest=n;
cout << "Enter A Number :" << endl;
cin >> n;
if (n<smallest)
{
smallest2=n;
smallest=n;
}
else
smallest2=n;
while (n >= 0)
{
cout << "Enter A Number :" << endl;
cin >> n;
if (n >= 0)
{
if(n < smallest)
{
smallest2=smallest;
smallest=n;
}
else if(n < smallest2 )
smallest2 = n;
}
}
cout << "Smallest = " << smallest << endl;
cout << "2nd Smallest = " << smallest2 << endl;
getch();
return 0;
}
|
thanksssssssssssssssssss.........great person
Topic archived. No new replies allowed.