Modify the average program to promote for intergers repeatedly.stop when a nagetive number is entere

#include<stdio.h>

int main(void)

{

intcount ,sum,aninterger;

printf("enterthe interger anf terminute with negtive number\n");

count=0;

sum=0;

printf("enternumber %d:\n",count+1);

scanf("%d",&aninterger);

while(aninterger>&&aninterger!='\n')

{

sum+=aninterger;

count++;

printf("enter number%d:\n",count+1);

scanf("%d",&aninterger);

}

if(count!=0)

printf("theaverage is %f\n",sum/(double)count);

else

printf("youshuru 了一个wronginterger\n");

return0;

}

上一篇:Media Query Max-Height 在手机是依赖 ICB 还是 viewport?


下一篇:html5的Canvas