Wisdom Materials
Home
About Us
Our Clients
Careers
Services
Education
Jobs
News
Business
Health
Astrology
Entertainment
RealEstate
Devotion
Contact Us
C Programs
/ if else ladder statement c program
Program Name
Write a C Program for if else ladder statement c program.
Theory
if else ladder statement is a decision based statement based on a condition.
Program Code
Copy Program Code
#include
void main() { int n1,n2,result,option; printf("Enter two numbers"); scanf("%d%d",&n1,&n2); printf("Enter option for Addion=1 Sub=2 Mul=3 div=4"); scanf("%d",&option); if(option==1) printf("sum= %d",n1+n2); else if(option==2) printf("Difference= %d",n1-n2); else if(option==3) printf("Product= %d",n1*n2); else if (option==4) printf("Quotint= %d",n1/n2); else printf("wrong option"); }
Input
Enter two numbers5 4 Enter option for Addion=1 Sub=2 Mul=3 div=4 1
Output
sum= 9
Online C Compiler (To copy paste and Run the c program)
Home
Back