Write a program following the equation : Y = f1x1+f2x2+f3x3+………………..+fnxn
Program:
#include<stdio.h>
main()
{
int f,x,i,y=0,n;
printf("n=");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("Value of [x%d]=",i);
scanf("%d",&f);
printf("Value of [y%d]=",i);
scanf("%d",&x);
y=y+f*x;
}
printf("y=%d",y);
}
main()
{
int f,x,i,y=0,n;
printf("n=");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("Value of [x%d]=",i);
scanf("%d",&f);
printf("Value of [y%d]=",i);
scanf("%d",&x);
y=y+f*x;
}
printf("y=%d",y);
}