C Basic 60: Math

6 January 2020, 12:26 am by antelove19

C programming language

C programming language



Happy Coding


main.c

/* ------------------------------------------------------------ */
/*  Math                                                        */
/*  Using Arithmetic Operators (integer)                        */
/*                                                              */
/*  Author: antelove                                            */
/*  Website: antelove.com                                       */
/* ------------------------------------------------------------ */

#include <stdio.h> // standar input output library

int main() {

    int a;
    int b = 2;

    printf("Input an integer ( > 2 ): \n");
    scanf("%d", &a);

    printf("%d + %d = %d \n", a, b, a + b);
    printf("%d - %d = %d \n", a, b, a - b);
    printf("%d * %d = %d \n", a, b, a * b);
    printf("%d / %d = %d \n", a, b, a / b);
    printf("%d mod %d = %d (remainder) \n", a, b, a % b);    

    getchar();

    return 0;    

}

Thank for reading :)


Keywords:


No Action Title
1 Live
2 Editor
0 comment