Numbers in C++

Following a simple example to show few of the mathematical operations on C++ numbers:

#include<iostream>

#include<cmath>

usingnamespacestd;

int main ()

{

// number definition:

short  s=10;

inti=-1000;

long   l =100000;

float  f=230.47;

double d =200.374;

// mathematical operations;

cout<<“sin(d) :”<< sin(d)<<endl;

cout<<“abs(i)  :”<< abs(i)<<endl;

cout<<“floor(d) :”<< floor(d)<<endl;

cout<<“sqrt(f) :”<<sqrt(f)<<endl;

cout<<“pow( d, 2) :”<< pow(d,2)<<endl;

return0;

}

Softecks Admin is a seasoned software engineer, tech enthusiast, and problem solver with a passion for modern software development. With years of hands-on experience in coding, system architecture, and emerging technologies, they break down complex concepts into practical, easy-to-follow insights. Through this blog, they share in-depth tutorials, best practices, and industry trends to help developers level up their skills and build scalable, efficient software solutions.