c- programming in 1-D array....

1. write a program in c to input to element in an array display the largest and smallest element by using 1-D array.
ans:- #include <stdio.h>
        #include <conio.h>
         void main()
        {
          int arr[10],i, large=0, small=0;
           clrscr();
         printf("input ten elements");
         for(i=0;i<10;i++)
        {
          scanf("%d", &arr[i]);
         if(arr[i]>0)
         large++;
         else
           if(arr[i]<0)
             small++;
    printf("\n largest=%d, \n smallest=%d", largest, smallest);
           getch();
                     }

Comments