program to accept ten numbers from the user and display the lowest one

This program accepts ten numbers from the user and display the lowest one,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "conio.h"
#include "stdio.h"
 
void main()
{
  int num[10],low,i=0,j=1;
  printf("\nPlease provide 10 numbers to find lowest one ");
  for(;i<10;i++,j++)
  {
  printf("\nEnter number %d : ",j);
  scanf("%d",&num[i]);
  }
  low=num[0];
  i=0,j=1;
//finding greatest number
  for(;inum[i+1])
    {
    low=num[i+1];
    }
  }
//displaying lowest value
  printf("\nThe lowest number is : %d",low);
getch();
}

Output:

Please provide 10 numbers to find lowest one
Enter number 1 : 45
Enter number 2 : 63
Enter number 3 : 85
Enter number 4 : 77
Enter number 5 : 21
Enter number 6 : 68
Enter number 7 : 79
Enter number 8 : 82
Enter number 9 : 101
Enter number 10 : 22
The lowest number is : 21

3 Responses to “program to accept ten numbers from the user and display the lowest one”

  1. #include
    #include

    void sort(int a[],int n)
    {
    int i,j;
    for(i=1;i<n;i++)
    {
    for(j=0;ja[j+1])
    {
    //swap(a[j],a[j+1]);
    a[j]=a[j]^a[j+1];
    a[j+1]=a[j]^a[j+1];
    a[j]=a[j]^a[j+1];
    }
    }
    }
    }
    int main()
    {
    int i,n;
    int a[10];
    printf(“Enter the number \n”);
    for(i=0;i<10;i++)
    {
    scanf("%d",&a[i]);
    }
    sort(a,10);

    printf("\nsmallest number among the number which u entered is – %d",a[0]);

    printf("\n\n") ;

    system("pause");
    return 0;
    }

    Reply

Leave a Reply