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 A C Program to split a number into digits

1 Ans Write a C program to implement x power n using recursion

1 Ans Write a C Program to check Anagrams of two strings

1 Ans Write a C program to reverse a number

1 Ans Write a C program to check a perfect number

1 Ans Write a C program to print Floyd Triangle

1 Ans Write a C program to print Fibonacci number series

1 Ans Write a C program to check Bubble sort data structure and algorithm

1 Ans Write a C program to print Pascal Triangle

1 Ans Write a C program to print Fibonacci number using recursion