# c++

c++ Concepts

## C Program to find hypotenuse without math.h

Write a C program to find hypotenuse of a right-angled triangle without using math.h. Let be the perpendicular and be the base of a right-angled triangle. The hypotenuse, is given by We can easily find the hypotenuse using the above formula but the catch is we cannot use math.h. Therefore, we cannot use sqrt() to …

## Program to find the difference between all elements of an array using pointers

Write a program to find the difference between all elements of an array using pointers. Each pair is only considered once.

## C Program to Count Number of Prime Numbers in a Given Range

Write a C program to count number of prime numbers in a given range. Naive Approach, using Sieve of Eratosthenes and using Dynamic Programming.

## C Program to find the square root of a number

In this article, we will study different ways we can find the square root of a number in C/C++. Program of Square root using the standard library The simplest way to find square root of a number is to use the standard library function sqrt(). double sqrt(double arg); It accepts a single argument of type …

## C Program to Find Prime Numbers in a Given Range

Write a c/c++ program to find the prime numbers in a given range. Naive Approach: loop through every number in the range if check if the number is prime.

## C Program to Check if a Number is Prime

Write a program in c to check if a number is prime or not. For example, Input 7 Output 7 is prime Input 14 Output 14 is not prime Prime Number: A positive number that is divisible by exactly 2 numbers – by 1 and by itself. For example, 13. 13 is only divisible by …

## Program to find roots of quadratic equation in c++

Write a c++ program to find roots of quadratic equation in c++ using class. We will find the roots of the quadratic equation using the discriminant. Suppose a quadratic equation The discriminant D of the above equation is The value of determinant defines the nature of the roots. If the discriminant is greater than 0, …

## C Program to Reverse a String without using String Functions

Write a c program to reverse a string without using string functions. Do not use strlen() and strev() functions to reverse string. Recursive implementation.

## Find all subsets of an array c++

Write a program to find all subsets of an array in c++. We can implement the problem in 2 ways – using recursion and without using recursion.

## C++ Iterate map

In this article, we will discuss 4 different ways to iterate map in c++. Iterate map using iterator First declare a iterator of suitable type and initialize it to the beginning of the map. After that, use a while to iterate over the map. Keep incrementing iterator until iterator reaches the end of the map.itr->first …