Advertisement
Vprento

2.Parovi celi broevi

Nov 9th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. int main() {
  3.     int z;
  4.     scanf("%d", &z);
  5.     int a, b;
  6.     int count = 0;
  7.     int totCount = 0;
  8.     while(scanf("%d %d", &a, &b)) {
  9.     if (a == 0 && b == 0) {
  10.     break;
  11.     }
  12.     if (a+b == z) {
  13.     count++;
  14.     }
  15.     totCount++;
  16.     }
  17.     printf("Vnesovte %d paovi od broevi chij zbir e %d\n", count, z);
  18.     float percentage = (float)(count*100) / totCount;
  19.     printf("Procentot na parovi so zbir %d e %.2f%%\n", z, percentage);
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement