求数组内两个数和等于数组内某一个数,输出两个数的下标
#include<stdio.h>
int main()
{
int target,i,j,n;
int nums[20];
printf("Enter the number of the nums:\n");
scanf("%d",&n);
printf("Enter the nums:\n");
for(i=0;i<n;i++)
scanf("%d",&nums[i]);
printf("Enter the target:\n");
scanf("%d",&target);
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
if(nums[i]+nums[j]==target) printf("%d %d",i,j);
return 0;
}