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
#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;}
+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