Menu Driven Program using Switch Case in C2 min read

In this tutorial, we will write a menu-driven program in C. We will use the switch case statement present in C to create menus or options. Before that, you may go through the following topic in C programming.

C Menu-driven Program using switch case:

This is a menu program in C that displays a menu and takes the input from the user. The choice made by the user is among the option displayed in the menu. And accordingly, the output is displayed on the screen. It is a user-friendly program in C.


Menu Driven Program using Switch Case in C

Output: 1

To find the areas of following press:
1 for the Area of a Circle
2 for the Area of a Square
3 for the Area of a Right Angled Triangle
4 for the Area of a Rectangle
5: Area of Rhombus
Enter your Choice: 1
Enter radius for the circle:2
Area: 12.560000

Output: 2

To find the areas of following press:
1 for the Area of a Circle
2 for the Area of a Square
3 for the Area of a Right Angled Triangle
4 for the Area of a Rectangle
5: Area of Rhombus
Enter your Choice: 4
Enter length and breadth for rectangle:
5
4
Area: 20

Similarly, you can create a calculator or any other program that serves a menu of options to choose from. You can use if..else statement instead of switch case.


MORE

Find the output ab, cd, ef, g for the input a,b,c,d,e,f,g in Javascript and Python

In this tutorial, we will write a program to find a pairs of elements from an array such that for the input [a,b,c,d,e,f,g] we will …

String Pattern Programs in C

In this tutorial, we will write various C pattern programs for String. Before that, you may go through the following topics in C. for loop …

Java Program to Find pair of Integers in Array whose sum is given Number

In this tutorial, we will write a program to find a pair of elements from an array whose sum equals a given number in java …

Program to Print Diamond Alphabet Patterns in C

In this tutorial, we will learn to write a C program to print Diamond patterns using alphabets/characters. However, in this tutorial, we will create a …

Half Diamond Pattern in C using Alphabets

In this tutorial, we will learn and code the half diamond alphabet patterns in C programming language. However, in this tutorial, we will create a …

Half Pyramid of Alphabets in C

In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in …