GTHER – EDITORIAL
Author: bigo_admin
Tester and Editorialist: tejaram15
Problrm Links:- Contest
and Practice
DIFFICULTY:
CAKEWALKPREREQUISITES:
ArrayPROBLEM:
Given an array of integers [A1,A2,…An] you need to find sum of all other indices of the given array excluding the current one.EXPLANATION:
Simply think that you need to find the number of candies that all other students have in your class the there are two different approaches…#include "stdio.h" int main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); int a[n+1]; long int sum=0; for(int i=0;i<n;i++) scanf("%d",&a[i]),sum+=a[i]; for(int i=0;i<n;i++) (i==n-1)?printf("%ld\n",sum-a[i]):printf("%ld ",sum-a[i]); } return 0; }