View Code of Problem 75

#include<stdio.h>
#include<math.h>
 int main()
{
 int i,j,a[10];
 int n;int temp;
 scanf("%d",&n);
  for(i=0i<n;i++)
  {
    scanf("%d",&a[i]);
    for(i=0;i<n;i++)
    {
    for(j=i+1,j<n;j++)
    {
     if(a[i]>a[j])
     {
      temp=a[i];
      a[i]=a[j];
      a[j]=temp;
       
     }
    }
    }
    for(i=0;i<n;i++)
    {
      printf("%d",a[i]);
    }
    
  }
 return 0;

}
/*
Main.c: In function 'main':
Main.c:8:11: error: invalid operands to binary < (have 'complex int' and 'int')
   for(i=0i<n;i++)
           ^
Main.c:8:17: error: expected ';' before ')' token
   for(i=0i<n;i++)
                 ^
                 ;
Main.c:13:14: warning: right-hand operand of comma expression has no effect [-Wunused-value]
     for(j=i+1,j<n;j++)
              ^
Main.c:13:22: error: expected ';' before ')' token
     for(j=i+1,j<n;j++)
                      ^
                      ;
*/

Double click to view unformatted code.


Back to problem 75