Thursday, 16 February 2017

Even Odd Calculation

Q : Write a program to sum all even and odd number from 1 to given number ?

Solution : 

Square and Cube of a given number

Q : Write a program to calculate of square and cube of a given number ?

Solution :

First n Multiplies of given number

Q : Write a program to display First n Multiplies of given number?

Solution : 

Perfect number program

Q : Write a program to check whether a number is perfect or not ?

A perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself. 

Example : 
6 = 1 + 2 + 3, 
28 = 1 + 2 + 4 + 7 + 14, 
496 = 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248 

Solution :