Task - In a cycle with a precondition, numbers are entered by the user until their sum exceeds 100. Determine the number of even and odd numbers entered
#include stdio.h #include conio.h #include math.h #include Windows.h #include iostream using namespace std; void main() { SetConsoleCP(1251); SetConsoleOutputCP(1251); float x, kn, kc, summa; summa = 0; kc = 0; kn = 0; do { printf("%s", "Vvedite chislo x: "); scanf("%f", &x); summa = x + summa; } while (summa < 100); if (x % 10 % 20 == 0) ++kc; else ++kn; x /= 10; } cout << "Kol-vo 4etnix cifr:" << kc < endl << "Kol-vo ne4etnix cift:" << kn << endl; }
ConsoleCPwhen working with Latin letters? :) - Harry