code for array of numbers addition where enter n,enter n array elemts ,first line specifies add other numbers except first index store in an another array,second line except second index add other.
ex-4
1 2 3 4
output:
9, 8, 7, 6
programming
#include
main()
{
int arr[10],n,i,j,ri,res[10],sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&arr[i]);
}
for(j=1;j<=n;j++)
{
for(i=1;i<=n;i++)
{
sum+=arr[i];
}
ri++;
sum=sum-arr[j];//to subtract respective index value
res[ri]=sum;//to store res array to print ri is important to refer index
sum=0;//to calculate further value
}
for(i=1;i<=n;i++)
{
if(i