🔒 Closed Guys pa help c++

Status
Not open for further replies.

Geneeyuu

Honorary Poster
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.webp
 
Status
Not open for further replies.

About this Thread

  • 9
    Replies
  • 715
    Views
  • 5
    Participants
Last reply from:
Unknown user

Online now

Members online
509
Guests online
806
Total visitors
1,315

Forum statistics

Threads
2,275,107
Posts
28,960,677
Members
1,233,595
Latest member
slotherhouse
Back
Top