Write a program to create a menu driven program to calculate square and cube of a number.
Answers
Answer:
Java program:-
// Java Program to find square, square root
// and cube of a given number
import java.util.*;
public class j5 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int num;
System.out.print("Enter an integer number: ");
num = sc.nextInt();
System.out.println("Square of " + num + " is: " + Math.pow(num, 2));
System.out.println("Cube of " + num + " is: " + Math.pow(num, 3));
System.out.println("Square Root of " + num + " is: " + Math.sqrt(num));
}
}
Answer:
Write a menu-driven program using Switch case to calculate the following: Area of circle. Area of square. Area of sphere. Also use functions input() and output() to input and display respective values. // C program to illustrate. // Menu-Driven program. // using Switch-case. #include <stdio.h> int input(); void output( ...