#include <iostream>
using namespace std;
int main()
{
int number_of_pods, peas_per_pod, total_peas;
cout << "Press return after entering a number.\n";
cout << "Enter the number of pods:\n";
cin >> number_of_pods;
cout << "Enter the number of peas in a pod:\n";
cin >> peas_per_pod;
total_peas = number_of_pods * peas_per_pod;
cout << "If you have " << number_of_pods << " pea pods and " << peas_per_pod;
cout << " peas in each pod, then you have " << total_peas << " peas in all the pods.\n";
return 0;
}
The result:
Press return after entering a number.
Enter the number of pods:
10
Enter the number of peas in a pod:
9
If you have 10 pea pods and 9 peas in each pod, then you have 90 peas in all the pods.
No hay comentarios.:
Publicar un comentario