Code Algorithm, Flowchart, Output for finding maximum and minimum of given number using array

 In this blog we will see the Code Algorithm, Flowchart, Output for finding maximum and minimum of given number using arrays.

Algorithm :

  • Start

  • Declare array and terms in array

  • Declare variables i, max, min

  • Enter marks of students

  • Initiate a for loop

  • Store the marks in array

  • Initiate for loop

  • Use if-else to find maximum and minimum value

  • Display the values 

  • End


FlowChart :

Code Algorithm, Flowchart, Output for finding maximum and minimum of given number using array


Code :

#include<stdio.h>

int main()

{

   int marks[5], i=0, max=0, min=100;

   printf("Enter marks of 5 students: ");

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

   {

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

   }

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

   {


       if (marks[i]>max)

       {

           max=marks[i];

       }

  

       if (marks[i]<min)

       {

           min=marks[i];

       }

   }

   printf("Maximum marks is: %d\n", max);

   printf("Minimum marks is: %d", min);

   return 0;

}


Output :

Comments

Popular posts from this blog

Code, Algorithm, Flowchart, Output for finding vowels in string