Sunidhi Bansal has Published 1078 Articles

C Program for focal length of a lens

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 11:20:43

440 Views

Given two floating values; image distance and object distance from a lens; the task is to print the focal length of the lens.What is focal length?Focal length of an optical system is the distance between the center of lens or curved mirror and its focus.Let’s understand with the help of ... Read More

Program for Mobius Function in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 11:17:22

508 Views

Given a number n; the task is to find the Mobius function of the number n.What is Mobius Function?A Mobius function is number theory function which is defined by$$\mu(n)\equiv\begin{cases}0\1\(-1)^{k}\end{cases}$$n=  0 If n has one or more than one repeated factorsn= 1 If n=1n= (-1)k  If n is product of k ... Read More

C Program for Hexagonal Pattern

Sunidhi Bansal

Sunidhi Bansal

Updated on 21-Nov-2019 12:28:19

2K+ Views

We are given with an integer ‘n’ and the task is to generate the hexagonal pattern and display the final output.ExampleInput-: n=5 Output-:Input-: n = 4 Output-:Approach we are using in the given program is as follows −Input the number ‘n’ from userDivide the entire pattern into three parts i.e. ... Read More

C++ Program to calculate the value of sin(x) and cos(x)

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Nov-2019 13:07:30

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 ... Read More

C++ Program to compute division upto n decimal places

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Nov-2019 12:59:42

1K+ 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, ... Read More

C++ Program to check whether points in a 3-D plane are Coplanar

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Nov-2019 12:54:39

505 Views

Given with the points (x1, y1, z1), (x2, y2, z2), (x3, y3, z3) and (x4, y4, z4) and the program must check whether the given points are coplanar or not. Points are said to be coplanar is they lie under same plane and if they are under different-2 planes than ... Read More

C++ Program to check if a given number is Lucky (all digits are different)

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Nov-2019 12:48:18

992 Views

Given with a number and the task is to check whether the input number is a lucky number or not and display the result.What is a Lucky NumberLucky number is the number whose each and every digit is different and if at least one digit is repeating than the number ... Read More

C++ Program to calculate the profit sharing ratio

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Nov-2019 12:44:56

526 Views

Given with an array of amount invested by multiple person and another array containing the time period for which money is invested by corresponding person and the task is to generate the profit sharing ratio.What is Profit Sharing RatioIn a partnership firm, profits and losses are shared between the partners ... Read More

C++ Program to calculate the number of odd days in given number of years

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Nov-2019 12:34:50

273 Views

Given with the positive integer value n and the task is to generate the number of odd days till the given year n.ExampleInput-: days = 500 Output-: number of odd days are: 5 Input-: days = 400 Output-: number of odd days are: 0How to calculate the number of odd ... Read More

C++ Program to calculate Double Integration

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Nov-2019 12:32:21

2K+ Views

We are given with the lower limit of variable x, upper limit of variable x, lower limit of variable y, upper limit of variable y, steps taken for corresponding x and steps taken for corresponding y and the task is to generate the double integration and display the result.ExampleInput-: steps ... Read More

Advertisements