write c Programming to calculate sum and average of three numbers

 

#Shell Script to calculate sum and average of three numbers
Shell Script 2.3(b):
echo “Enter three numbers”
read nl, n2, n3
sum=`expr $n1 + $n2 + $n3`
avgl=`expr $sum / 3`
avg2= expr $sum & 3`
avg2=`expr $avg2 \* 100 / 3
echo “$sum is the sum”
echo “$avgl. $avg2 is the average”

Write a Program to calculate sum and average of three numbers in C language?

#include
main()

{
float nl, n2, n3, sum-0, avg; #lrscr();
clrscr();
printf(“Enter three numbers”);
(“%f”,&n1, &n2, &n3);
= nl + n2 + n3;
avg = sum / 3;
printf(“Average is %f”, avg);
printf(“Sum is %f”, sum);

}

Write a Program to calculate sum and average of three numbers in C++?

#include
main()
{
int nl, n2, n3, sum-0, avgl, avg2;
clrscr();
printf(“Enter three numbers”);
scanf(“%d%d%d”, &nl, &n2, &3);
Sum = nl + n2 + n3;
avgl = sum / 3;
avg2 = sum % 3;
avg2 = avg2 * 100 / 3;
printf(“Average %d.%d”, avgl, avg2);
printf(“Sum is %d”, sum);
}

#Shell Script to calculate sum and average of three numbers

Shell Script 2.3(a)
echo “Enter three numbers: ”
read nl n2 n3
expr $nl + Sn2 + $n3`
echo $sum / 3.0 | bc
“Scum is the sum”
echo “Savg is the average”