C Programming
C Programming

Calculator Program in C | #C #Coding

Calculator Program in C | #C #Coding

C Programming
C Programming

 

//

//  main.c

//  Calculator

//

//  Created by SHIVAM SINGH on 10/03/22.

//

#include <stdio.h>

int main()

{

    // insert code here…

    printf(“Input two numbers \n”);

    float number1 , number2 , calculation ;

    int choice ;

    scanf(“%f %f” , &number1 , &number2 );

    printf(“\nPress 1 for addition \nPress 2 for Subtraction \nPress 3 for Multiplication \nPress 4 for Division \n Input your Choice “);

    scanf(“%d” , &choice );

    switch(choice)

    {

        case 1 :

            calculation = number1 + number2 ;

            printf(“Addition is : %f” , &calculation );

            break;

        case 2 :

            calculation = number1 – number2 ;

            printf(“Subtraction is : %f” , &calculation );

            break;

        case 3 :

            calculation = number1 * number2 ;

            printf(“Multiplication is : %f” , &calculation );

            break;

        case 4 :

            calculation = number1 / number2 ;

            printf(“Division is : %f” , &calculation );

            break;

        default:

            printf(“Invalid Input”);

            break;

    }

    printf(“\n”);

    return 0;

}

 

 


 

 


 

Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.

Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.

 

🧑‍💻🧑‍💻 Social Media Links of Tech DCode :

👉🏻 YouTube : https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
👉🏻 Instagram : https://www.instagram.com/thetechdcode/
👉🏻 Facebook Page : https://www.facebook.com/thetechdcode
👉🏻 Twitter : https://twitter.com/thetechdcode
👉🏻 Telegram Channel : https://t.me/thetechdcode
👉🏻 Tech DCode Linktree : https://linktr.ee/thetechdcode
👉🏻 My Personal Handles : https://linktr.ee/virtualshivamin

🧑‍💻🧑‍💻 Social Media Links of SHIVAM SINGH (OWNER) :

👉🏻 Instagram : https://www.instagram.com/virtualshivamin/
👉🏻 Facebook Page : https://www.facebook.com/virtualshivamin/
👉🏻 Twitter : https://twitter.com/virtualshivamin/
👉🏻 Personal Linktree : https://linktr.ee/virtualshivamin 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *