Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone

C Program to display arithmetic operations using a switch case

YASH PAL, 31 July 2024

In this tutorial, we are going to write a C Program to display arithmetic operations using a switch case in C Programming with practical program code and step-by-step full complete explanation.

C Program to display arithmetic operations using a switch case

C Program to display arithmetic operations using a switch case

#include<stdio.h>
#include<conio.h>

void main()
{
	int a,b,n,s,m,su,d;

	clrscr();

	printf("Enter two Numbers: ");
	scanf("%d%d",&a,&b);
	printf("Enter 1 for sumn 2 for multiplyn 3 for subtractionn 4 for divison: ");
	scanf("%d",&n);

	switch(n)
	{
	case 1:
	s = a+b;
	printf("sum=%d",s);
	break;
	case 2:
	m = a*b;
	printf("multiply=%d",m);
	break;
	case 3:
	su = a-b;
	printf("subtraction=%d",su);
	break;
	case 4:
	d = a/b;
	printf("division=%d",d);
	break;
	default:
	printf("Wrong input");
	break;
	}

	getch();
}

Output

Enter two Numbers: 8
4
Enter 1 for sum
2 for multiply
3 for subtraction
4 for division: 1
sum = 12
c coding problems solutions

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes