Hello!

I am working on some code for a program that squares,sums and divides 3 numbers:

``````int num,sq,sumd;
int a;
int b;
int c;

printf ("Please enter a positive integer for a/n"); //input

scanf ("%d", &a);

printf ("Please enter a positive integer for b/n"); //input

scanf ("%d", &b);

printf ("Please enter a positive integer for c/n"); //input

scanf ("%d", &c);

sq=(num*num);
printf("the square of %d is %d",num,sq);
return 0;
}

int num,sq,sumd;

printf("number here");

scanf("%d",&num);

sumd=sum(num);

printf("sum here %d",sumd);

return 0;

}``````

have not done the subtract yet? I also need a results!

Hye hi,
Actually you have not mentioned your problem clearly & exactly. According to me you need a help for program which add subtract and square three numbers ok.
So, for this your solution is here:you may define three different functions for that

``````{
int a,b,c,s,sqr,sub;

printf("Enter Three positive integer numbers: ");
scanf("%d%d%d",&a,&b,&c);
squr(a,b,c);
sub(a,b,c);
}

{
int w;
w=x+y+z;
printf("Addition of three numbers is:   %d",w);
}

void squr(int x,int y, int z)
{
printf("\n square of %d is: %d",x,x*x);
printf("\n square of %d is: %d",y,y*y);
printf("\n square of %d is: %d",z,z*z);
}

void sub(int x,int y,int z)
{
int w;
w=x-y-z;
printf("\n Subtraction of three numbers is: %d", w);
}``````

if it is solved then ok otherwise mention your query clearly what exactly you need?

Sorry, my question was not clear the input is 3 numbers then you square each number sum them the divide by n. For example
1 5 3
1 25 9
1+25+9=35
3/5=11.66

Thanks!

1. take the first three numbers(which you have already done)
2. find their squares... a*a, b*b, c*c store them in the same variable
3. sum them, a+b+c
4. Divide by n

That simple... :)