Basic Calculator in C
unknown
c_cpp
17 days ago
488 B
4
Indexable
Never
#include<stdio.h> int main() { // declare variables int n1, n2, Addition, Subtraction, Mult, Div; // take input printf("Enter first number:"); scanf("%d", & nl); printf("Enter second number:"); scanf("%d", &n2); //perform operations Addition = n1 + n2; Subtraction = nl - n2; Mult = n1 * n2; Div = nl / n2; // display result printf("Addition: %d\n", Addition); Printf("Subtraction: %d\n", Subtraction); Printf("Multiplication: %d\n", Mult); printf("Division: %d\n", Div); return ();
Leave a Comment