View Code of Problem 75

#include<stdio.h>
int main()
{
  int i,a[10];
  for(i=0;i<10;i++)
  {
    scanf("%d",&a[i]);
  }
  int min=0,temp;
  for(i=0;i<10;i++)
  {
    for(int j=i+1;j<10;j++)
    {
      if(a[max]<a[j])
      {
        temp=a[max];
        a[max]=a[j];
        a[j]=temp;
      }
    }
    for(i=0;i<10;i++)
    {
     printf("%d\n",a[i];)
    }
  }
}
/*
Main.c: In function 'main':
Main.c:14:12: error: 'max' undeclared (first use in this function)
       if(a[max]<a[j])
            ^
Main.c:14:12: note: each undeclared identifier is reported only once for each function it appears in
Main.c:23:24: error: expected ')' before ';' token
      printf("%d\n",a[i];)
                        ^
Main.c:24:5: error: expected ';' before '}' token
     }
     ^
Main.c:9:7: warning: unused variable 'min' [-Wunused-variable]
   int min=0,temp;
       ^
*/

Double click to view unformatted code.


Back to problem 75