0% found this document useful (0 votes)
19 views

Question 1:. Save Your Work and Use The Filename (Act1Whileloop - Lastname)

The document contains C++ code that uses a while loop to input multiple numbers from the user, calculate the minimum single digit number among all inputs, and output the smallest number.

Uploaded by

jaja
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Question 1:. Save Your Work and Use The Filename (Act1Whileloop - Lastname)

The document contains C++ code that uses a while loop to input multiple numbers from the user, calculate the minimum single digit number among all inputs, and output the smallest number.

Uploaded by

jaja
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Question 1:.

Save your work and use the filename (Act1whileLoop_Lastname)

#include <iostream> Output:


enter a number:
using namespace std; 2
enter a number:
int main() 3
{
enter a number:
int n, sm, min = 9;
4
cout<<"enter a number:\n"; enter a number:
cin>>n; 6
enter a number:
while (n<=6){ 7
the smallest number is 2
sm = n % 10;
n /= 10;
if (sm < min)
min = sm;

cout<<"enter a number:\n";
cin>>n;
}
cout<<"the smallest number is"<<" "<<min;

return 0;
}

You might also like