ASSIGNMENT(CHAPTER 5)
ASSIGNMENT 4
(CONTROL STATEMENT-DECISION +LOOPING)
DRAW ALGORITHM AND FLOWCHART
- WAP to read a number from the user and test whether the number is negative. [ Show message “ THE NUMBER IS NEGATIVE” if it is a negative number , otherwise show nothing. [if-statement]
- WAP to read the percentage of marks obtained by a student in SLC and +2 level. Display message “CONGRATULATIONS!!! You have first division in both SLC and +2” if both levels have percentage greater than or equal to 60.[nested if]
- WAP to read a number from user and determine whether the number is even or odd.[if-else]
- WAP to read three numbers from user and determine the largest among them.[using conditional operator]
- WAP that reads total marks of a student in seven subjects. Then calculate the percentage and determine the division. Use following condition:[if-else if]
i)Percentage greater than or equal to 80 = distinction
ii)Percentage between 60-79 = first division
ii)Percentage between 45-59 = second division
ii)Percentage between 32-44 = third division
ii)Percentage less than or equal to 31 = fail
- WAP to find the second largest (or middle number ) among three numbers.
- WAP that asks an arithmetic operator and two operands and performs the corresponding operation on the operands using the SWITCH statement.
- WAP that to determine all roots(real and imaginary) of a quadratic equation by using both [switch and if else] statement
- The monthly electricity bills to be computed as follows:
i)Minimum Rs 80/- for up to 20 units
ii)Rs 7.30 per unit for next 100 units
iii)Rs 9.00 per unit for any units beyond 120 units
WAP to compute monthly bills for a given number of units consumed by a customer.
- A bank has introduced an incentive policy. A bonus of 2% of the balance is given to everyone, irrespective of their balances and 5% is given to female account holder if their balance is more than Rs 5000/-. WAP to represent this policy and calculate balance after bonus.
- WAP that finds the value of y based on the value of x in the following function. y={2x+300 for x<50, 200 for x=50 and 50x-100 for x>50}
- WAP to calculate the factorial of a number [while loop]
- WAP that ask an integer number n and calculate sum of all natural numbers from 1 to n[for loop]
- WAP to read a number from the keyboard until a zero or a negative number is keyed in . Finally calculate sum and average of entered numbers.
- WAP to display a multiplication table of 5-10.
- WAP to determine whether a number is prime or not.[use break statement]
- WAP that asks for a number n from user and then display only even numbers from 2 to n[continue statement]
- WAP to ask two numbers . Display message” EITHER NUMBER IS NEGATIVE” if either number is negative ; otherwise display message” BOTH NUMBER ARE POSITIVE”.[goto statement]
- WAP that asks for a number n from user and then display only even number from 2 to n [use continue statement]
- WAP to ask two numbers. Display message” EITHER NUMBER IS NEGATIVE” if either number is negative ; otherwise display message “BOTH ARE POSITIVE”.
- WAP to find HCF and LCM of two numbers.
- WAP to generate Fibonacci series of n terms entered by the user using iteration.
- WAP to count the number of digits in a number.
- WAP to compute the sum of digits of a given integer number.
- WAP to reverse the digits of a number (if a number is 12345, the reversed number is 54321)
- WAP to check whether the entered number is perfect or not.
- WAP to find the number of and sum of all integers greater than n1 and less than n2 and divisible by 7, where n1<n2 and n1 & n2 are read from the keyboard.
- WAP to display all Armstrong numbers in a certain range [from n1 to n2] given by user.
- Program to compute cosine series
cos(x) = 1-x^2/2!+x^4/4!+x^6/6!+...+x^n/n!
- Program to compute cosine series
Sin x = x - x^3/3! + x^5/5! -x^7/7! +...
- WAP to convert decimal numbers to binary.
- WAP to convert binary to decimal numbers.
- WAP to read a number, find its reverse and check whether it is PALINDROME or not.
- WAP to display all prime numbers between n1 and n2 where n1<n2 and n1 &n2 are read from the keyboard.
- WAP to check if the entered number is STRONG or not.
- WAP to read a number and find its PRIME FACTOR.
- WAP to input decimal numbers and display its digits in words with reverse order.
- WAP to input a 5-digit number and display its digits in words.
- WAP that reads a character and performs following operations according to the choice inputted by the user.
- Display “ IT IS VOWEL” if the entered character is a vowel otherwise “ IT IS CONSONANT”.
- Display “ IT IS DIGIT” if the entered character is a member of digit , otherwise display the ASCII value of entered character
- WAP TO CHECK WHETHER A NUMBER IS ARMSTRONG OR NOT.