0
What is the problem in this program
#include<stdio.h> main() { int i,j,num,temp,maxDiff=0; printf("Enter number of elements\n"); scanf("%d",&num); int a[num]; printf("Enter numbers\n"); for(i=0;i<num;i++) { scanf("%d",&a[i]); } for(i=0;i<num;i++) { for(j=i+1;j<num;j++) { if(a[j]-a[i]>maxDiff) { maxDiff=a[j]-a[i]; } } } printf("Maximum Difference is %d\n",maxDiff); }
1 Answer
+ 3
Please post your code in the description or save it as a sololearn playground code and then post it here. Right now it's cut off in the title of the code, so no one can help you.