Skip to content

Latest commit

 

History

History
31 lines (28 loc) · 4.48 KB

File metadata and controls

31 lines (28 loc) · 4.48 KB

readme

Loop Questions

WAP = Write a Program
Thank you Cardi B for ruining programming for me! 😢😞😞
Number Question Solution Link
1 WAP To Print Numbers From 1 to 10 Solution
2 WAP to Calculate the Sum of the First N Natural Numbers Solution
3 WAP that prompts the user to input a positive integer. It should then print the multiplication table of that number. Solution
4 WAP to compute the factorial of any number N given by the user. Solution
5 WAP to compute a ^ b without using the inbuilt power operator (assume a is integer and b positive integer) Solution
6 WAP that prompts the user to input an integer and then outputs the number with the digits reversed. For example, if the input is 12345, the output should be 54321. Solution
7 WAP that reads a set of integers, and then prints the sum of the even and odd integers. Solution
8 WAP that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. Solution
9 WAP a loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user whether he or she wishes to perform the operation again. If so, the loop should repeat; otherwise it should terminate. Solution
10 WAP to enter the numbers till the user wants and at the end it should display the count of positive, negative and zeros entered. Solution
11 WAP to enter the numbers till the user wants and at the end the program should display the largest and smallest numbers entered. Solution
12 WAP to print out all Armstrong numbers between 1 and 500. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number. For example, 153 = ( 1 * 1 * 1 ) + ( 5 * 5 * 5 ) + ( 3 * 3 * 3 ) Solution
13 WAP to print Fibonacci series of n terms where n is input by user : 1 1 2 3 5 8 13 24 ..... Solution
14 WAP to calculate the sum of following series where n is input by user. 1 + 1/2 + 1/3 + 1/4 + 1/5 + ... 1/n Solution
15 Compute the natural logarithm of 2, by adding up to n terms in the series 1 - 1/2 + 1/3 - 1/4 + 1/5 -... 1/n where n is a positive integer and input by user. Solution
16 WAP that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." The program should use a loop that repeats until the user correctly guesses the random number. Solution
17 WAP to compute sin(x) for given x. The user should supply x and a positive integer n. We compute the sine of x using the taylor series and the computation should use all terms in the series up through the term involving x^n sin(x) = x - x^3/3! + x^5/5! - x^7/7! + x^9/9! ... Solution
18 WAP to compute cos(x) for given x. The user should supply x and a positive integer n. We compute the cosine of x using the taylor series and the computation should use all terms in the series up through the term involving x^n cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! ... Solution
19 Loops (Hackerrank) Solution
20 Print Function Solution