Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- // #include "q.c"
- // #include <stdio.h>
- int divisor(int n)
- {
- int i,x=0,a;
- for (i=1;i<=n;i++)
- {
- a=n%i;
- if (a==0) // i é divisor de n
- x+=i;
- }
- return x;
- }
- int main(int argc, char *argv[])
- {
- if (argc != 2) // quero pedir só um argumento
- {
- printf("Uso correto: %s n \n",argv[0]);
- exit(1);
- }
- int n = (int) atoi(argv[1]);
- // int N = (int) atoi(argv[2]);
- // float dt = (float) atof(argv[3]);
- // strcpy(filename,argv[4]);
- int f;
- f=divisor(n);
- printf("%d \n",f);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement