Advertisement
Spocoman

Division Without Remainder

Sep 17th, 2023 (edited)
832
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int n, number, p1 = 0, p2 = 0, p3 = 0;
  8.     cin >> n;
  9.  
  10.     for (int i = 1; i <= n; i++) {
  11.         cin >> number;
  12.         if (number % 2 == 0) {
  13.             p1++;
  14.         }
  15.         if (number % 3 == 0) {
  16.             p2++;
  17.         }
  18.         if (number % 4 == 0) {
  19.             p3++;
  20.         }
  21.     }
  22.  
  23.     printf("%.2f%%\n%.2f%%\n%.2f%%\n", 100.0 * p1 / n, 100.0 * p2 / n, 100.0 * p3 / n);
  24.        
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement