Ask Question - Get Answer

1 Ans Write a C program to find the highest and lowest number in a series

Asked by AL MaMun (4 Golds) Friday, 31 Jul 2020, 04:32 PM at (Education Tutorials)

Please log in to answer, like and save
0
Save 0

<<< Previous
Log in to Answer Next >>>

Answer(s):

A C program to find Highest and Lowest number in a number series


#include<stdio.h>

int main()

{

    int i, j, n, a[100], highest, lowest, temp;

    printf("How many numbers: ");

    scanf("%d", &n);

    printf("Enter %d numbers now: \n", n);

    for(i=0; i<n; i++)

    {

        scanf("%d", &a[i]);

    }

    ///Insertion sorting

    for(j=1; j<n; j++)

    {

        for(i=0; i<n; i++)

        {

            temp=a[i];

            if(a[i]>a[j])

            {

                a[i]=a[j];

                a[j]=temp;

            }

        }

    }

    printf("\nHighest Number = %d\n", a[n-1]);

    printf("Lowest Number = %d", a[0]);

    return 0;

}


Answered by AL MaMun (4 Golds) Friday, 31 Jul 2020, 04:32 PM

Please log in to Upvote, Downvote and Report
           

Related Q/A:

1 Ans Write a C program to implement Insertion sort data structure and algorithm

3 Ans BPSC Assistant Programmer Lab Aptitude test Programs and Queries with Proper solution (Taken By BCC)

1 Ans Write a C Program to find factorial using recursion

1 Ans A C program to input and display an Array

1 Ans Best Web development site in the internet ?

1 Ans Write a C program for Interest Calculation

1 Ans Write a C program to print Floyd Triangle

2 Ans Write a C program for Binary Search algorithm

1 Ans Write a C program to Find Armstrong Number series upto a Number

1 Ans Write a C program to find nth Fibonacci number