Welcome Guest.

1Answers

This is a programming problem with a number of prints, but I can’t lose the answer after compiling.

Asked by: Jessica Ward 173 views IT September 9, 2018

#include<stdio.h>

void wanshu(int m)

{int sum=0,i;

for(i=1;i<=m/2;i++)

{if(m%i==0)

sum+=i;

}

if(sum==m)

printf("%d",sum);}

int main(void){

int a,b,n;

scanf("%d%d",&a,&b);

for(n=a;n<=b;n++);

{wanshu(n);}

return 0;}

1 Answers

  1. +4Votes  

    Is the program exiting directly after running, many compilers will not automatically add the “press any key to exit” function, you can add getchar () before the main function return; or system ("pause"); block the program Exit directly

    White- September 9, 2018 |