1
Where should I fit the accumulators of this code I have written for now?
#include <stdio.h>
int main()
{
int N;
int somapar;
int somaimpar;
do{
printf("\n Digite um número qualquer: ");
scanf("%d", &N);
if (N % 2 == 0){
printf("\n Número escolhido é par!");
}
else {
printf("\n Número escolhido é ímpar");
}
}while (N >= 0);
printf("\n");
return 0;
}
The enunciation of the algorithm is this:
Write an algorithm to show on the screen whether each N number typed by the user is even or odd. The algorithm should also show on the screen the sum of all even numbers, the sum of all odd numbers, the percentage of even numbers and the percentage of odd numbers entered. The algorithm must terminate its execution if the user enters a number less than zero.
If you have another question, ask a new question, do not change what has already been answered.
– Maniero