Write a C program to perform the following tasks In main Inp

Write a C program to perform the following tasks: In main Input four integers and call a function to calculate the sum of them using call-by-reference. In function Calculate and return sum of four integers.

Solution

solution)

#include<stdio.h>

int sumofintegers(int *a,int *b,int *c,int *d)
{
   int sum=*a+*b+*c+*d;
  
   return sum;
}

int main()
{
  
   int no1,no2,no3,no4;
  
   printf(\"please enter four integers \ \");
  
   scanf(\"%d%d%d%d\",&no1,&no2,&no3,&no4);
  
   int result=sumofintegers(&no1,&no2,&no3,&no4);
  
   printf(\"the sum value of %d and %d and %d and %d is \\t %d\",no1,no2,no3,no4,result);
  
  
}

output

please enter four integers
50
60
70
80
the sum value of 50 and 60 and 70 and 80 is 260

 Write a C program to perform the following tasks: In main Input four integers and call a function to calculate the sum of them using call-by-reference. In func

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site