You are on page 1of 1

Assignment 4

Do all the questions using While Loop


Write a program which will continue taking input from user until the 0 is entered by user. Write a program which will continue taking input from user until the 0 is entered by user, also show the sum of all inputs. Write a program that will take input from user and will check either number is prime or not. An integer greater than 1 is prime if its only positive divisor is 1 or itself. For example, 2, 3, 5, and 7 are prime numbers, but 4, 6, 8, and 9 are not. According to a study, the approximate level of intelligence of a person can be calculated using the following formula: i = 2 + ( y + 0.5x)

Write a program, which will produce a table of values of i, y and x, where y varies from 1 to 6, and for each value of y, x varies from 5.5 to 12.5 in steps of 0.5 . Implement a program that takes the number of students in a class from the user. Calculate their sum and average. Implement a program that displays the factorial of a user defined positive integer. If the integer is not positive, convert it to a positive number and then calculate factorial. Implement a program that takes the value of base and exponent from the user. The program should determine and display the result of base^exponent.

You might also like