Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int f1=7, f2=20, f3=140, N;
- scanf("%d", &N);
- if(N<0 || N>120) return 0;
- if(N<=10) printf("%d", f1);
- if(N>10 && N<31) printf("%d", f1+((N-10)*1));
- if(N>31 && N<101) printf("%d", f1+f2+((N-30)*2));
- if(N>100 && N<121) printf("%d", f1+f2+f3+((N-100)*5));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement