C Basic 61: Math float

6 January 2020, 12:29 am by antelove19

C programming language

C programming language



Happy Coding


main.c

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

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

int main() {

    float a;
    float b = 2.00f;

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

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

    getchar();

    return 0;    

}


Thank for reading :)


Keywords:


No Action Title
1 Live
2 Editor
0 comment