Opening Ceremony

Bhim Higher Secondary School Suntopar, Dolakha

Opening Ceremony

Bhim Higher Secondary School Suntopar, Dolakha

JCT Students (First Batch(2069-2070))

Bhim Higher Secondary School Suntopar, Dolakha

Opening Ceremony

Bhim Higher Secondary School Suntopar, Dolakha

Opening Ceremony

Bhim Higher Secondary School Suntopar, Dolakha

Showing posts with label Prodcut. Show all posts
Showing posts with label Prodcut. Show all posts

Sunday, July 31, 2016

Program in C to find sum, difference and product of 2 numbers using switch case statement

/* Program in C to find sum, difference and product of 2 numbers using switch case statement */
#include<stdio.h>
#include<conio.h>
void main()
{
    int a,b,ch;
    printf("\n Enter First Number :");
    scanf("%d",&a);
    printf("\n Enter Second Number :");
    scanf("%d",&b);
    printf("\n Enter Your Choice: ( 1. Sum:  2. Difference :  3. Product: ) ");
    scanf("%d",&ch);
    switch (ch)
    {
        case 1:
            {
                printf("\n The sum = %d",a+b);
                break;
            }
            case 2:
            {
                printf("\n The difference = %d",a-b);
                break;
            }
            case 3:
            {
                printf("\n The Product = %d",a*b);
                break;
            }
            default:
            {
                printf("\n out of range");
            }
    }
    getch();
}