fork download
  1. #include <stdio.h>
  2.  
  3. int main(){
  4. int data[]={-3,-10,0,7,2,7,-9,6,-9,4},max=0,max_i=0;
  5. for(int i=0;i<10;i++){
  6. if(max<data[i]*data[i]){
  7. max=data[i]*data[i];
  8. max_i=i;
  9. }
  10. }printf("%d",max_i+1);
  11. return 0;
  12. }
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
2