Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(){
- int Z;
- scanf("%d", &Z);
- int a, b;
- float ednakvi_na_z = 0.0;
- float vkupno_parovi = 0.0;
- while(scanf("%d%d", &a, &b)) {
- if(a == 0 && b == 0) {
- break;
- }
- if(a + b == Z) {
- ednakvi_na_z++;
- }
- vkupno_parovi++;
- }
- printf("Vnesovte %.0f parovi od broevi chij zbir e %d\n", ednakvi_na_z, Z);
- float procent = ednakvi_na_z / vkupno_parovi;
- procent *= 100.0;
- printf("Procentot na parovi so zbir %d e %.2f%%\n", Z, procent);
- return 0;
- }
- /*
- 100
- 50 50
- -50 -50
- -99 199
- 32 98
- 0 0
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement