brsjak

Parovi celi broevi - SP Lab 3 - 10/10

Oct 25th, 2016
588
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. # include <stdio.h>
  2. int main () {
  3. int cel,a,b,brojac=0,pomoshnazaprocent=0;
  4. float procent;
  5.  
  6. scanf ("%d", & cel);
  7. for (;1;pomoshnazaprocent++)
  8. {
  9.  
  10.  
  11.   scanf ("%d %d",&a,&b);
  12.  
  13.   if((a==0)&&(b==0))
  14.  
  15.  
  16.  
  17.     break;
  18.  
  19.  
  20.  
  21. if (a+b==cel)
  22. brojac++;
  23. }
  24.  
  25.  
  26. procent=(brojac*100.0)/pomoshnazaprocent;
  27.  
  28. printf("Vnesovte %d parovi od broevi chij zbir e %d\n",brojac,cel);
  29. printf("Procentot na parovi so zbir %d e %.2f%%",cel,procent);
  30. return 0;
  31. }
Add Comment
Please, Sign In to add comment