C++ adding int and float variables

C++ adding int and float variables

June 28, 2024·İbrahim Korucuoğlu
İbrahim Korucuoğlu

In this example, we show how to find the sum of 2 variables of type int and float.

#include <iostream>

int main() {
    int firstNumber = 11;
    float secondNumber = 12.8;
    float sum = firstNumber + secondNumber;

    std::cout << "Sum: " << sum << std::endl;

    return 0;
}
Last updated on