Wednesday, May 20, 2020

Math functions in C++


  • Program :

#include <iostream>
#include <cmath>
using namespace std;

int main() {
  cout <<"\n----------------MATH FUNCTIONS----------------\n";
  cout <<"\nThe max of two numbers is "<< max(10, 100);
  cout <<"\nThe min of two numbers is "<< min(5, 20);
  cout <<"\nThe sqrt is "<<sqrt (64);
  cout <<"\nThe round is "<< round(2.6);
  cout <<"\nThe log is "<< log(2) ;
  return 0;
}




  • Output :


No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...