Guest User

Untitled

a guest
May 24th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. //Посчет счастливых билетов.
  2. #include <stdio.h>
  3.  
  4. int main(){
  5.     int n, count=0, i, b=0;
  6.     float c;
  7.     for (n = 0; N<28; ++n){
  8.         for (i=0; i<1000; ++i)
  9.             if (((i/100)+((i/10)%10)+(i%10))==n){++count;}
  10.         b=b+count*count;
  11.         count=0;
  12.     }
  13.     c=100.0/(1000000.0/b);
  14.     printf("Vsego schastlivyh biletov: %d\n", b);
  15.     printf("V procentah ot vseh: %.2f%%\n", c);
  16.     return 0;
  17. }
Add Comment
Please, Sign In to add comment