Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int x;
- int suma=0;
- int main(int argc, char *argv[]) {
- system("cls");
- printf("%s","Podaj liczbe ktora chcesz sprawdzic czy jest ona doskonala \n");
- scanf("%i",&x);
- for(int i=1;i<=x/2;i++){
- if(x%i==0){
- suma=suma + i;
- }
- }
- if(suma==x){
- printf("%s","Podana liczba jest doskonala \n");
- }
- printf("%i",suma);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement