Problem based on array
You have been given an array of positive integers A1,A2,...,An with legnth N and you have to print an array of same legnth(N) where the values in the new array are the sum of every number in the array, except the number at that index. #include<stdio.h> #define MAX 10 int main() { int n; int a[MAX]; int b[MAX]; printf("Enter the no of arr elements: "); scanf("%d", &n); printf("Enter the arr elements:\n"); for(int i = 0; i < n; i++) { printf("A[%d]: ", i); scanf("%d", &a[i]); } for(int i = 0; i<n; i++) { for(int j = 0; j<n; j++) { while(i != j) { b[j] += a[i]; } } } for(int i = 0; i<n; i++) { printf("\n%d", b[i]); } return 0; } Please help and let me know what's wrong with my logic!