Thursday, 16 February 2017

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 :

HCF and LCM Java Program

Q : Write a program to input two number and find out HCF and LCM ?

Solution : 


class lcm {
 void get(m1, m2) {