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 x power n using recursion

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

1 Ans Write a C program to find nth Fibonacci number

1 Ans Write a C program to print Pascal Triangle

1 Ans A C Program to split a number into digits

1 Ans The general rules for constructing names for variables (unique identifiers)

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 Armstrong Number series upto a Number

1 Ans Write a C program to check a Palindrome Number

1 Ans Single Digit Interest Rate in the Banking Sector: Problems and Prospects - essay writing