class sqcube
{
public static void main(String as[])
{
System.out.println("square and cube
program");
int n=5;
int sq,c;
sq=n*n;
c=n*n*n;
System.out.println("square
"+sq+ " cube "+c);
}
}
Output:
To compile this code use below command
D:\JavaPrograms\SimplePrograms>javac sqcube.java
To run this code use below command
D:\JavaPrograms\SimplePrograms> java sqcube
square and cube program
square
25 cube 125
0 Comments
Post a Comment