Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int main(int argc, const char * argv[]) {
- int n;
- scanf("%d", &n);
- int maks_zbir = 0;
- int broj;
- for(int i = n - 1; i >= 0; i--) {
- int zbir = 0;
- for(int j = 1; j <= i; j++) {
- if(i % j == 0) {
- zbir += j;
- }
- }
- if(maks_zbir < zbir) {
- maks_zbir = zbir;
- broj = i;
- }
- }
- int brojac = 0;
- for(int i = n - 1; i >= 0; i--) {
- int zbir = 0;
- for(int j = 1; j <= i; j++) {
- if(i % j == 0) {
- zbir += j;
- }
- }
- if(maks_zbir == zbir) {
- brojac++;
- }
- }
- printf("%d %d %d\n", broj, maks_zbir, brojac);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement