Michael
10/16/2008 1:14:00 PM
questions wrote:
> I want to build a calculation,that is letting the first two integers
> multiply,then printf the sum1,and next step I input the third
> integer,I want to let the third integer multiply the sum1.I' ve done a
> program,but it does not run as I want ,how could I rework it?
>
> # include <stdio.h>
> int main()
> {int integer1;
> int integer2;
> int integer3;
> int sum1;
> int sum2;
>
> printf("enter the first integer\n");
> scanf("%d",&integer1);
>
> printf("enter the second integer\n");
> scanf("%d",&integer2);
>
> sum1=integer1 * integer2;
> printf ('sum1 is equal to %d\n",sum1);
> scanf("%d",&sum1);
>
> printf("enter the third integer\n");
> scanf("%d",&integer3);
>
> sum2=sum1*integer3;
> printf("the sum2 is %d\n",sum2);
>
> return 0;}
printf ('sum1 is equal to %d\n",sum1);
This line is wrong, it should be changed into
printf ("sum1 is equal to %d\n",sum1);