#include <stdio.h>

int main(void)  
{
//  Local Declarations
    int num1, num2, num3, num4, num5;
    int choice;
    int smallest, largest;
    int sum;
    int average;

//  Statements
    printf("Please enter 5 numbers: ");
    scanf("%d %d %d %d %d", &num1, &num2, &num3, &num4, &num5);
    
    printf("======MAIN MENU====== \n");
    printf("[1] Add \n");
    printf("[2] Find the Average\n");
    printf("[3] Find the smallest \n");
    printf("[4] Find the largest \n");
    printf("Enter your choice...");
    scanf("%d", &choice);
    
    switch(choice) 
       {
          case 1 : sum = num1 + num2 + num3 + num4 + num5;
                   printf("The sum of the numbers are: %d\n", sum);
                   break;
          case 2 : average = (num1 + num2 + num3 + num4 + num5) / 5;
                   printf("The average of the numbers are: %d\n", average);
                   break;
          case 3 : // Finding the smallest
                   smallest = num1;
                   if (num2 < num1)
                       smallest = num2;
                   if (num3 < num2)
                       smallest = num3;
                   if (num4 < num3)
                       smallest = num4;
                   if (num5 < num4)
                       smallest = num5;
                                  
                   else if (num5 < num1)
                       smallest = num5;
                       printf("The smallest number is: %d\n", smallest);
                   break;
          case 4 : // Finding the largest
                   largest = num1;
                   if (num2 > num1)
                       largest = num2;
                   if (num3 > num2)
                       largest = num3;
                  if (num4 > num3)
                       largest = num4;
                   if (num5 > num4)
                       largest = num5;
                                  
                   else if (num5 > num1)
                      largest = num5;
                   printf("The largest number is: %d\n", largest);
                   break;
          default : printf("Invalid choice!\n");           
       }// end of switch
    
    system("pause");
    return 0;
}// main

You would. It's lame, rigid, and two years old. There are much better ways, and many have been posted in the past two years.

Comments
you are a big help in my activity thankyou
#include<stdio.h>
void main()
{
  int arr[]={102,201,30,41,5,6,17,8,9,10};
  int sml,lar,sum;
  int i;
  sum=0;
  for(i=0;i<10;i++)
    sum=sum+arr[i];
  printf("The sum is %d\n",sum);
  lar=arr[0];
  sml=arr[0];
  for(i=1;i<10;i++)
    {
    if (lar<arr[i])
       lar = arr[i];
    }
   printf("The largest number is %d\n",lar);
    for(i=1;i<10;i++)
    {
    if (sml>arr[i])
       sml = arr[i];
    }
   printf("The smallest number is %d\n",sml);
}

Edited 5 Years Ago by Narue: added code tags