Lab 4
Lab 4
Lab 4
NO MATRIC : BI22160523
ANSWER LAB 4
___________________________________________________________________________________
_________________________
PRACTICE 1 :
#include <iostream>
using namespace std;
int main()
{
const double highTempt = 102.5;
double tempt;
cout << "Enter the substance's Celsius temperature:>>";
cin >> tempt;
return 0;
}
PRACTICE 2 :
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int score1, score2, score3;
double avg;
char testscore;
cout << "This program calculates the average of three test scores. " << endl;
do
{
cout << "Enter score #1 : ";
cin >> score1;
cout << "Enter score #2 : ";
cin >> score2;
cout << "Enter score #3 : ";
cin >> score3;
cout << "Would you like to average another set of test scores ? " <<
endl;
cout << "Enter Y for yes or N for no : ";
cin >> testscore;
return 0;
}
PRACTICE 3 :
#include <iostream>
using namespace std;
int main()
{
int number, multif = 1;
cout << "The entered Integer is : " << number << endl;
while (number != 0) {
multif = multif * (number % 10);
number = number / 10;
}
cout << "The multiplication of digit for this integer is :" << multif;
return 0;
}
PRACTICE 4 :
#include <iostream>
using namespace std;
int main()
{
cout << "ABC BANK AUTOMATIC TELLER MACHINE ATM\n";
cout << "============================================\n";
while (b > 9) {
b = b - 10;
b4++;
}
//print
cout << "Number of 100 bills : " << b1 << endl;
cout << "Number of 50 bills : " << b2 << endl;
cout << "Number of 20 bills : " << b3 << endl;
cout << "Number of 10 bills : " << b4 << endl;
return 0;
}