User Friendly Calculator

My Instagram (@saai9111)


This Post Is For The Code To Make A User Friendly Type Calculator Using C Lang'.

-------------------------------------------------------------------------------------------------------------------

I Have Used Dev C++

------------------------------------------------------------------------------------------------------------------

Here's The Code.....

------------------------------------------------------------------------------------------------------------------

#include<stdio.h>
#include<math.h>
#include<conio.h>
#include<stdlib.h>
main()
{
char s;
float a,b,ans;
printf("Enter: ");
scanf("%f%c%f",&a,&s,&b);
    switch(s)
    {
    case '+':
    ans=a+b;
    printf("RESULT: %f",ans);
        break;
    case '-':
    ans=a-b;
        printf("RESULT: %f",ans);
        break;
    case '*':
    ans=a*b;
    printf("RESULT: %f",ans);
    break;
    case '/':
    ans=a/b;
    printf("RESULT: %f",ans);
    break;
    default:
    printf("Operator Was Not Found.......");
    break;
}
getch();
}

-------------------------------------------------------------------------------

Here's The Output........

-----------------------------------------------------------------------------



Follow Me On Instagram And Subscribe Me On YouTube

Comments

Post a Comment

Popular Posts