What's new

Closed Guys pa help c++

Status
Not open for further replies.

A k o s i A j i n

Honorary Poster
Joined
Nov 15, 2016
Posts
302
Solutions
1
Reaction
66
Points
152
Age
24
guys pako nag poprogram error talaga palage huhu freshmen bsit po ako
pano po ba to?
write a program that inputs three integers from the keyboard and prints the sum, average, product.
haysss
 
#include <iostream>
using namespace std;

int main ()
{
int Num1,Num2,Num3;

cout << "Please enter the first integer value: ";
cin >> Num1;
cout << "Please enter the second integer value: ";
cin >> Num2;
cout << "Please enter the third integer value: ";
cin >> Num3;
cout<<"The sum is"<<Num1+Num2+Num3<<".\n";
cout<<"The product is"<<Num1*Num2*Num3<<".\n";

return 0;
}
 
#include <iostream>
using namespace std;

int main ()
{
int Num1,Num2,Num3;

cout << "Please enter the first integer value: ";
cin >> Num1;
cout << "Please enter the second integer value: ";
cin >> Num2;
cout << "Please enter the third integer value: ";
cin >> Num3;
cout<<"The sum is"<<Num1+Num2+Num3<<".\n";
cout<<"The product is"<<Num1*Num2*Num3<<".\n";

return 0;
}

Yan lang naman requirements mo.. Add and product...
 
try nyo po ito
Code:
//Iostream kasi kukuha tayo ng input sa user pati mag lalabas din tayo ng output
#include <iostream>
//eto naman po para sa standard namespace
using namespace std;

main(){
    //isang number lang po since di naman i-ooutput yung value ng tatlong number.
    int number;
    //yung sa total po kelangan naka initialize para di undefined yung value.
    int total=0;
    //same din po sa product
    int product = 1;
 
    for (int i=1;i<=3;i++){
        cout << "Value of number " << i << ": ";
        cin >> number;
        total = total + number;
        product = product * number;
    }
    cout << "SUM: " << total << endl;
    cout << "AVERAGE: " << total/3 << endl;
    cout << "PRODUCT: " << product << endl;

}
output:
average.jpg
 

Attachments

Last edited:
Status
Not open for further replies.

Similar threads

Back
Top