Last active
April 19, 2025 14:10
-
-
Save jkasun/53a364b60b2e92b05ba469d9481dd71a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Online C++ compiler to run C++ program online | |
#include <iostream> | |
float pi = 3.141; | |
// This should take circleRadius as a parameter and rutrn the area | |
float caculateArea(float r) { | |
// Area = Pi x Square(R) | |
float area = pi * r * r; | |
return area; | |
} | |
float calculateC(float r) { | |
// c = 2 * pi * r; | |
return 2 * pi * r; | |
} | |
// return the addition of 2 number | |
int add(int num1, int num2) { | |
// int total = num1 + num2; | |
// return total; | |
return num1 + num2; | |
} | |
float divide(int num1, int num2) { | |
return num1 / float(num2); | |
} | |
// return if the number is even or odd | |
bool isEven(int number) { | |
// if (number % 2 == 0) { | |
// return true; | |
// } else { | |
// return false; | |
// } | |
return number % 2 == 0; | |
} | |
int main() { | |
float circleRadius = 20; | |
float area = caculateArea(circleRadius); | |
// float c = calculateC(circleRadius); | |
int total = add(2, 3); | |
// std::cout << divide(2,3); | |
float x = 230000000000e10; | |
std::cout << x; | |
std::cout << "\n"; | |
std::cout << int(x); | |
// for (int x = 2; x < 8; x++) { | |
// std::cout << x; | |
// std::cout << "->"; | |
// std::cout << caculateArea(x); | |
// std::cout << "\n"; | |
// } | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment