Calculator in c programming language

//AOTHER: NIRAJ BHAGVAT

//DATE : 7/10/2021

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char name[20];
printf("What is your name\n");
scanf("%s",&name);
printf("\t\tHello %s",name);

float a,b,result;
char op;//operation
  
   
    printf("\n\n\t    WELCOME TO CALCULATOR");
    Niraj:
   
    printf("\nEnter first Number : ",a);
    scanf("%f",&a);
    printf("\nEnter the Operation : ",op);
    scanf(" %c",&op);
    printf("\nEnter Second Number : ",b);
    scanf("%f",&b);
switch (op)
{
    case '+': result=a+b;
    printf("\nAddition= %f\n",result);
    break;
   
    case '-': result=a-b;
    printf("\nSubtraction= %f\n",result);
    break;
   
    case '*': result=a*b;
    printf("\nMultiplication= %f\n",result);
    break;
   
    case '/': result=a/b;
    printf("\nDivision= %f\n",result);
    break;
   
    default :
    printf("\nplease select proper operator\n");

}
goto Niraj;
}

Comments

Popular posts from this blog

Pointer to Matrix In C