Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int n = 0;
- scanf_s("%d", &n);
- float count2 = 0;
- float count3 = 0;
- float count4 = 0;
- for (int i = 0; i < n; i++)
- {
- int num;
- scanf_s("%d", &num);
- if (num % 2 == 0)
- {
- count2++;
- }
- if (num % 3 == 0)
- {
- count3++;
- }
- if (num % 4 == 0)
- {
- count4++;
- }
- }
- printf_s("%.2f%%\n", ((count2 / n) * 100));
- printf_s("%.2f%%\n", ((count3 / n) * 100));
- printf_s("%.2f%%\n", ((count4 / n) * 100));
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment