Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

after entering num1 and num2...I pressed enter and my proggram is not run

+6 votes
asked Nov 5 by Umor faruk suptoo (180 points)

#include<stdio.h>

int main()

{

    int num1,num2;

    printf("please enter a number\n");

    scanf("%d",&num1);

   

    printf("please enter another number\n");

    scanf("%d\n",&num2);

    printf("%d+%d=%d\n",num1,num2,num1+num2);

    printf("%d-%d=%d\n",num1,num2,num1-num2);

    printf("%d*%d=%d\n",num1,num2,num1*num2);

    printf("%d/%d=%d\n",num1,num2,num1/num2);

    return 0;

}

2 Answers

+1 vote
answered Nov 5 by Peter Minarik (63,320 points)
scanf("%d\n",&num2);

should ve

scanf("%d",&num2);

instead.

0 votes
answered Nov 5 by 0720310229 (140 points)
**//Make it look like something like this instead;

#include<stdio.h>

int main()

{

    int num1,num2;

    printf("please enter a number");

    scanf("%d",&num1);

   

    printf("please enter another number");

    scanf("\n%d",&num2);

    printf("\n%d+%d=%d",num1,num2,num1+num2);

    printf("\n%d-%d=%d",num1,num2,num1-num2);

    printf("\n%d*%d=%d",num1,num2,num1*num2);

    printf("%d/%d=%d",num1,num2,num1/num2);

    return 0;

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...