 Hello friends, I am Naval Yamul working as an assistant professor in Mechanical Engineering Department, Walsh and Institute of Technology, Sholapur. In this video, we are going to see the programs on C++. Learning Outcome At the end of this session, students will be able to understand basic programs of C++. In the end of this video is the programs on C++. So, you will see the first program, plus plus program to find the square root of a number. So, here we are using two header files, one is iostream and one is math. iostream is used for input-output functions like cout and cin and math is used as a scientific calculator. In this program, we are finding the square root of any number. So, for that the function required is sqrt, it is a function to find the square root of any number. So, the main program starts with the third line that is int main, then followed by the int number and float result. Here two data types are used that is integer and float and two variables are used that is number and result. Cout is used, then insertion operator enter a number, enter a number is displayed on the screen, then the user enters a number that is stored in number that is no, c in extraction operator and the number entered by the user is stored in a number. Then there is a logic or here the result is calculated as the function, the function is sqrt then followed by the number. So here the whatever the answer that is stored in the result should be displayed on the screen that displayed is given with the function that is cout, square root of a number is then insertion operator result. Then we are using insertion operator and and l and l is a manipulator that is used to get the cursor for the next line. So the program output will be enter a number, suppose user enters 16 as a number, the square root of a number will be 4.0, 4.0 because the result is in float. So we will see the next program that is c++ program to find the square of any number. The logic for this program is very simple that is n square. So we are using a header file and a math file to header files then main program starts here then int two variables n comma result cout enter a number whatever the number entered by the user is stored in n and here the logic here is result is equal to the function used is POW that is power in bracket n comma two where the first first digit that is n shows a base and followed by the order or race two. So here n comma two refers to n race to two n is a number which is taken from the user and race to two. So we get a square of any given number and the cout will be square of the given number is equal to then followed by the result. So whatever we are used the logic that is power n comma two that is stored in the result and the result is displayed here. So the output will be like this enter a number suppose user enters 4 as a number the square of the given number is 16. So the logic here in this program is POW function power n comma two. So the next program it is very simple here c plus plus program to find the cube of any number if you understand the previous program this program becomes very simple here everything is same here just we are using function power n comma three that is n race to three again here n is a base and three is the order or race to. So I will read this program once again int two variables n comma result n is a variable which is taken from the user and result is used to calculate the result that is power or cube of this program so cout enter a number that is stored in n result is calculated as the function POW power n comma three the cube of the given number will be the result is called here and n l manipulator is used so that the cursor moves to the next line. So the output will be like this enter a number three the cube of a given number is 27 that is three race to three gives 27 so pause of pause this video for few seconds and think on a writing a program to find the power of any number okay we will see this program so c plus plus program to find power of any number. So again we are using two header files then we are using three variables here that is base comma power comma results so base and power are two variables and result variable is used to calculate base race to power so cout enter base and power the two numbers which taken from the user are stored in base and power result will be power base comma power so what the first number will be on base and the second number entered by the user will be of power the cout will be power of a given number is equal to and result is called here and n l manipulator is used again. So for example if enter base and power if the user enters three comma four the power of a given number will be three race to four that gives 81 as a result. So we will see next program that is c plus plus program to enter the equilateral side of the equilateral triangle and finding the area of that so the logic here is area is equal to root three by four into a square gives the area of the equilateral triangle. So we need to know the logic of the program that is area of the equilateral triangle here again we are using two iter files one is iostream and math and we are taking two variables that is int a for the side of the equilateral triangle and float area area to calculate the area of the equilateral triangle. So cout enter the side of the equilateral triangle and that whatever the side is entered that stored in area sorry a then area is calculated as square root the function here is sqrt square root of three divided by four point zero into a into a here four point zero is used because area is a variable from float data type. So we are using four point zero here then cout area of the equilateral triangle is then area is called the output will be like this enter the side of the equilateral triangle that is equal to ten the area of the equilateral triangle will be forty three point three zero. So we will see the next program that is to find the simple interest the logic here is simple of the simple interest is p into n into r divided by 100 p is principal n principal amount n is rate of period and r is the rate of period rate of interest. So here we are using only one header file iostream.h then int three variables in integer and one variable in float that is si. So we need to take a three variables for principal amount as p and period of time as n and the rate of interest as r all three variables taken from the user are stored in p, n and r. Here the logic is si that is simple interest is equal to p into n into r divided by hundred point zero hundred point zero is used because si is a variable taken from the float data type. So your simple interest is given as si. So si is a variable where the result is stored and si is called here the output will be enter the principal amount the period of time and the rate of interest if the user enters one lakh and period of time as two and rate of interest as twelve your simple interest will be twenty four thousand. Si plus plus program to find the compound interest the logic here is compound interest p into one plus r by hundred raise to n. So we are using one header two header files here because we want to use power as a function. So the logic here is si is equal to p into power of one plus r by hundred comma n where one plus r by hundred is a base raise to n that is comma n that all is calculated by a function p o w and those all value is multiplied with a principle into p. So here again there are three variables and in three variables taken in integer and si variable is taken in float. So cout enter principal amount period of time and rate of interest c in is equal to c in will be stored in p n and r and the logic as explained before cout your compound interest will be and si is called. So the output will be enter principal amount period of time rate of interest hundred two and twelve your compound interest will be one twenty five point four four. So we will see a program to find the area of circle as we all know the logic here for area of circle is pi r square. So we are using math as a header file again here the function p o w is used again for r comma two where r is a radius which is entered by the user and stored in r comma two that is raise to r and those all values multiplied with pi value that is three point one four. So that all value is stored in a so we have taken a in float as a data type. So area of circle and a is called here. So enter the radius of circle five area of circle will be seventy eight point the references thank you.