Pages
Assignment
Synopsis
C
Graphics
Compiler
C#
DCN
DBMS
Discrete Math
DS
IT Fun
Java
Json
NIELIT
Notes
Office
OOPS
OS
PHP
Project
Phython
Question
SSAD
Web
UGC Net
VB
ASP
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 :
class
squarecube
{
void
get_num(
int
n)
{
int
i;
for
(i=1;i<=n;i++)
{
System.out.println(
"Square of "
+ i +
" is "
+(i*i) +
" , Cube is "
+ (i*i*i));
}
}
}
Download Source Code
Next Question
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment