- 28th Jul 2020
- 05:42 am
- Admin
C Programming Assignment Question
Write a program that asks the user to enter any integer value in two different arrays for any range
C Programming Assignment Solution
#include #define _CRT_SECURE_NO_WARNINGS float fun(int a[], int b[], int count) { int c[1000]; float avg=0; printf("\nAddition of the elements of the array: "); for(int i=0;i { c[i] = a[i] + b[i]; printf("%d ",c[i]); avg = avg + c[i]; } return avg/(float)(count); } int main(void) { printf("Hello World\n"); int a[1000],b[1000],c[1000]; int count; printf("\nHow many numbers do you wish to enter ?"); scanf("%d",&count); printf("\nEnter %d numbers in the first array: ",count); for(int i=0;i scanf("%d",&a[i]); printf("\nEnter %d numbers in the second array: ",count); for(int i=0;i scanf("%d",&b[i]); float avg = fun(a,b,count); printf("\nAverage = %lf",avg); return 0; }