- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7347 Articles for C++
125 Views
In this tutorial, we will be discussing a program to find the rate percentage from compound interest of the consecutive years.For this, we will be provided with two integers say A and B that are the interests of two consecutive years. Our task is to find the rate of interest for the given values.Finding the relation between the given values and eliminating the principal amount, we get the formula asrate = ((B-A)*100)/AExample#include using namespace std; //calculating the rate of interest float calc_rate(int N1, int N2) { float rate = (N2 - N1) * 100 / float(N1); return ... Read More
177 Views
In this tutorial, we will be discussing a program to find the radius of the incircle of a given triangle.For this, we will be provided with the sides of a particular triangle and our task is to find the radius of the incircle in that triangle.The formula for finding the radius of incircle isarea of the triangle/half perimeter of the triangleExample#include using namespace std; //calculating the radius of incircle float calc_radius(float a, float b, float c) { if (a < 0 || b < 0 || c < 0) return -1; //half perimeter of ... Read More
64 Views
In this tutorial, we will be discussing a program to find the quantity of milk left after mixture replacement.Let us suppose we have X litres of milk. From that, Y litres of milk is replaced with Y litres of water itself. This same procedure is done again and again Z number of times. Our task is to find the final amount of milk left in the container.Finding the relation among the values between the repetitive operations, we find the formula for finding the amount of milk after Z number of operations to beamount left = ((X-Y)/X)Z*XExample#include using namespace std; ... Read More
449 Views
We are given with three arrays where first array contains the upper limit for arithmetic mean, second array contains the lower limit for arithmetic mean and third array contains the frequencies and the task is to generate the arithmetic mean of class intervals given.What is Arithmetic Mean?Arithmetic mean is the average value that is calculated by dividing the sum of all the elements in the set with the total number of elements in the given set.How to calculate Class Interval Arithmetic MeanGiven with Lower Limit, Upper Limit, FrequencyLower LimitUpper LimitFrequency121342563784Calculate the mid-point by adding the upper limit and lower limit ... Read More
3K+ Views
Given with the P number of processes in the memory and N number of needed resources by them to complete their execution and the task is to find the minimum number of resources R which should be allotted to the processes such that deadlock will never occur.What is a DeadlockDeadlock is situation in an operating system where multiple processes residing in the memory doesn’t able to perform their execution because the resources which are needed for program execution is being hold by another resource who is waiting for some other resource for completion.Let’s say there are two processes P1 and ... Read More
419 Views
Given with a positive integer and the task is to generate the odd factors of a number and finding out the sum of given odd factors.ExampleInput-: number = 20 Output-: sum of odd factors is: 6 Input-: number = 18 Output-: sum of odd factors is: 13So, result = 1 + 5 = 6Approach used in the below program is as follows −Input the number for calculating the sum of odd factors of that numberIgnore the digit 0 and 2 because both are even digits and store the digit 1 because it is an odd digitStart the loop from 3 ... Read More
243 Views
Given with the positive value n and the task is to generate the triangular pattern i.e. mirror image of the printed numbers and display the resultExampleInput-: n = 6 Output-:Input-: n = 3 Output-:Approach used in the below program is as follows −Input the value of n as a positive integerTraverse one loop i for the number of rows in a pattern i.e. nTraverse one loop j for the number of spaces in a patternTraverse another loop for the digits in a patternAlgorithmSTART Step 1-> declare function to print mirror image of triangular pattern void print_mirror(int n) declare ... Read More
1K+ Views
Given with the input as hours and the task is to convert the number of hours into minutes and seconds and display the corresponding resultFormula used for converting the hours into minutes and seconds is −1 hour = 60 minutes Minutes = hours * 60 1 hour = 3600 seconds Seconds = hours * 3600ExampleInput-: hours = 3 Output-: 3 hours in minutes are 180 3 hours in seconds are 10800 Input-: hours = 5 Output-: 5 hours in minutes are 300 5 hours in seconds are 18000Approach used in the below program is as follows ... Read More
5K+ Views
Given with the input as angles and the task is to calculate the value of sin(x) and cos(x) corresponding to the given angle and display the resultFor Sin(x)Sin(x) is a trigonometric function which is used to calculate the value of x angle.Formula$$\sin (x) = \displaystyle\sum\limits_{k=0}^\infty \frac{(-1)^{k}}{(2k+1)!}x^{2k+1}$$For Cos(x)Cos(x) is a trigonometric function which is used to calculate the value of x angle.Formula$$\cos (x) = \displaystyle\sum\limits_{k=0}^\infty \frac{(-1)^{k}}{(2k)!}x^{2k}$$Approach used in the below program is as follows −Input the value of x angle for sin(x) and cos(x)Apply the formulas given for sin(x) and cos(x)Print the resultALGORITHMSTART Step 1-> declare function to calculate value of ... Read More
950 Views
Given with the value of x and y as a positive integer with the value of n for number of decimal places and the task is to generate the division up to n decimal places.ExampleInput-: x = 36, y = 7, n = 5 Output-: 5.14285 Input-: x = 22, y = 7, n = 10 Output-: 3.1428571428Approach used in the below program is as follows −Input the value of a, b and nCheck if b is 0 than division will go upto infinite and if a is 0 than result will be 0 as something divides to 0 is ... Read More