C++ Tutorial #1 Math functions(square root, division)

22

C++ Tutorial #1 – Code With Me
After the First program of “Hello World”
This is the  first lesson for beginners for simple mathematics
For more detail 
#include<stdio.h>
#include<math.h>
int main(void)
{
int s;                                  /*let s be an integer*/
double value;                               /*let the word value act as a double integer*/
double a,b,c;                               /*let the alphabet a,b,c act as a double integer*/
s=100;                                  /*Now the integer s replaces the value 100*/
printf(”        division    square    4squareroot\n”);          /*The word inside the inverted comma(“”) is printed out in the user’s wall*/
printf(“*___________________________________________________*\n”);  /*This line is a form of  designe in the user’s wall*/
/* now we are about to enter into the main function of the programme*/
while((–s)>=0)                          /* untill  the integer ‘s’  is greater or equals to ‘0’,the while function goes into the loop for 100 times*/
{

value=s;                            /* now we have value=s, where the value replaces the integer ‘s’*/
/* now we are about to enter the if loop function*/
if(s%3==0 || s%3==1)                             /*when the integer ‘s’ is divided by the number 3 and if the remainder is 0 or if the remainder is 1, then enter the if loop else goto to the line 21*/
{
continue;                   /* if the condition given above the line 17 is true, then the if loop continues to function untill the if loop becomes false*/
}
a=1/value;                          /* when the 1 is divided by the value, we will get the division of the number . and the divided number is replaced in the value ‘a’*/
b=value*value;                          /* when the value is multiplied value, then we get the square numberof a particular square. The result is replaced in the value ‘b’*/
c=sqrt(sqrt(value));                            /*In C programming, sqrt means the square root of the particular  nuber, in this function, the programme helps to find the square root of the word ‘value’. similarly, the result is replaced in the value ‘c’. the function results the 4 square roof of value*/
printf(“%5.1f\t  %5.3f\t %6.1f\t  %6.4f\n”,value,a,b,c);    /*the number %5.1f  %5.3f %6.1f %6.4f replaces the result in value,a,b,c respectively.*/
}
return 0;
}

Comments

comments