105k views
4 votes
write a C++ program that ask the user for the number of cookies eaten and display the calorie consumption

User Fricke
by
6.0k points

1 Answer

2 votes

Answer:

#include <iostream>

using namespace std;

int main()

{

int cookies;

cin >> cookies;

cout << "The calorie consumption is: " << cookies * 142 << endl;

return 0;

}

Step-by-step explanation:

First line: include basic library of C++(input and output).

using namespace std;

Says to compiler we are using std.

int main() Main function

int cookies, cookies variable, of int type

cin >> cookies

get the number of the cookies from user

cout Print the text and calories(one cookie have 142 calories)

Have a nice day ;)

User Dinushan
by
5.1k points