Anderson Pozo

Generation

generate functionMon, 24 Jul 2023

Hacer un programa para ingresar cinco números y listar cuántos de esos cinco números son positivos.

int i,j,k,l,m,positiveNumbers; positiveNumbers = 0; cout << "Enter the value of first variable: "; cin >> i; cout << "Enter the value of second variable: "; cin >> j; cout << "Enter the value of third variable: "; cin >> k; cout << "Enter the value of fourth variable: "; cin >> l; cout << "Enter the value of fifth variable: "; cin >> m; if (i > 0) positiveNumbers = positiveNumbers + 1; if (j > 0) positiveNumbers = positiveNumbers + 1; if (k > 0) positiveNumbers = positiveNumbers + 1; if (l > 0) positiveNumbers = positiveNumbers + 1; if (m > 0) positiveNumbers = positiveNumbers + 1; cout << "The total number of positive numbers inputed are: " << positiveNumbers;

Questions about programming?Chat with your personal AI assistant