Saturday, July 2, 2022
HomeWordPress DevelopmentMaking a Primary C Calculator

Making a Primary C Calculator


Here is how one can make a Primary C Calculator.

Get extra C Calculator Examples right here.

Ailing first provide the code then unwell clarify the way it works.

#embody <stdio.h>
#embody <stdlib.h>

int foremost()

{
  double number1, number2; // Creates two variables

  printf("Enter First Quantity: "); // Takes First Quantity
  scanf("%lf", &number1); // Shops first quantity in number1

  printf("Enter Second Quantity: "); // Takes Second Quantity
  scanf("%lf", &number2); // Shops second quantity in number2

  printf("The Addition of the 2 is: %f", number1 + number2); // Prints out the addition of the 2 numbers
  return 0;

}
Enter fullscreen mode

Exit fullscreen mode

Okay so this is how this system works.

This system first makes two variables number1 and number2. The place we will retailer our first and second quantity.

This system then asks the consumer for an enter of the primary quantity and second second quantity that are then saved in variable number1 and number2.

After this system bought each the primary quantity and second quantity it is going to add them collectively utilizing operator ‘+’ and print out the reply.

This system is utilizing double as a substitute of int in order that it may calculate decimal numbers additionally.

You may change the ‘+’ operator to the rest additionally like -, x and so on.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments