Search This Blog

Read Your Language

Basic Calculator in C

Basic Calculator made by C Programming 

#include<stdio.h>
#include<conio.h>
int main()
{
    int a, b,c, choice;
    float d;

printf("-----------------Basic Calculator ------------------------\n");

printf(" -----------Please Type The your choice (1-4) ------------\n");
printf(" 1.Addtion\n ");

printf("2.Subtration  \n ");

printf("3.Multipication\n ");

printf("4.Division \n ");
    scanf("%d",&choice);

switch(choice)
{
case 1:     printf(" please Enter the Two numbers \n");
            scanf("%d%d",&a,&b);
            c=a+b;
            printf("Your addition is the : %d",c);
            break;
case 2: printf(" please Enter the Two numbers\n ");
            scanf("%d%d",&a,&b);
            c=a-b;
            printf("Your Subtraction is the : %d",c);
            break;
    case 3:     printf(" please Enter the Two numbers \n");
            scanf("%d%d",&a,&b);
            c=a*b;
            printf("Your Multipication is the : %d",c);
           break;
case 4: printf(" please Enter the Two numbers \n");
            scanf("%d%d",&a,&b);
            d=a/(float)b;
            printf("Your Division is the : %0.4f",d);
            break;
default : printf("Wrong type your Choice ");          
               break;
   }
}



OUTPUT: 

-----------------Basic Calculator ------------------------
-----------Please Type The your choice (1-4) ------------
1
please Enter the Two numbers
4 6
Your addition is the :10

No comments:

Contact Form

Name

Email *

Message *

Followers