Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Посчет счастливых билетов.
- #include <stdio.h>
- int main(){
- int n, count=0, i, b=0;
- float c;
- for (n = 0; N<28; ++n){
- for (i=0; i<1000; ++i)
- if (((i/100)+((i/10)%10)+(i%10))==n){++count;}
- b=b+count*count;
- count=0;
- }
- c=100.0/(1000000.0/b);
- printf("Vsego schastlivyh biletov: %d\n", b);
- printf("V procentah ot vseh: %.2f%%\n", c);
- return 0;
- }
Add Comment
Please, Sign In to add comment