UPDATED:

How To Make A Simple Calculator By C Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... This blog is under construction!!!!
Namecheap.com
Showing posts with label multiplication. Show all posts
Showing posts with label multiplication. Show all posts

Thursday, May 26, 2016

How to make simple calculator by C

We are going to make a simple calculator by C.By this calculator we can do summation,subtraction,multiplication and division.Lets have a look to the program.


how to make a simple calculator by c
#include <stdio.h>
#include <conio.h>

int main()
{
    float a,b,sum,sub,mul,div;
    char ch;

    printf("Enter a number: \n");
    scanf("%f", &a);

    printf("Enter another number: \n");
    scanf("%f", &b);

    sum=a+b;
    sub=a-b;
    mul=a*b;
    div=a/b;

    printf("What do you want?\n");
    printf("a: summation.\t b: subtraction.\nc: multiplication.\t d: division.\n");

    scanf(" %c",&ch);

    if(ch == 'a')
    {

        printf("summation value: %.2f\n",sum);

    }
    else if(ch == 'b')
    {

        printf("subtraction value: %.2f\n",sub);

    }
       else if(ch == 'c')
    {

        printf("multiplication value: %.2f\n",mul);

    }
       else if(ch == 'd')
    {

        printf("division value: %.2f\n",div);

    }
    else
    {

        printf("something went wrong!!\n");
    }

    return 0;
    }


Now Try it by yourself.If you face any problem and you have any question regarding the program you can comment below.
Thank you.

Friday, March 4, 2016

Summation,Subtraction,Multiplication and Division by C

Now we are going to do summation with C.Write down the following program and compile it.Then see what happen.


Program Code


#include <stdio.h>
int main ()
{
    int a;
    int b;
    int sum;
    a = 50;
    b = 60;
    sum = a + b;
    printf("sum is %d",sum);
    return 0;
}





Program details:

At first we named three variables as our wish.I took a,b, and sum.Here i assigned 50 for a and 60 for b.sum= a+b means i assigned a value in sum which is equal to a+b.You already know about the printf function.Here it commanded to print the value of sum.

Work for you:

Now you have to do subtraction,multiplication and division following this program.When you done post your program in comment box here or in our facebook group Coder Mania BD.

## If you face any problem with C program join our facebook group C Clinic by Coder Mania BD to get solution.

Thanks for being with Coder Mania BD.

Namecheap.com

Popular Posts