Sum of n numbers

后端 未结 4 789
猫巷女王i
猫巷女王i 2021-01-25 01:32
#include 

int main()
{   
    int m,i,sum,num;

    i=0;
    sum=0;
    scanf(\"%d \",&m);
    while(i

        
4条回答
  •  猫巷女王i
    2021-01-25 02:14

    This is because you have a space after your %d in the scanf lines.

    Change

    scanf("%d ",&num);
    

    To

    scanf("%d",&num);   
    

    Scanf usually ignores whitespaces, so you don't want spaces in your format strings.

提交回复
热议问题