Posts

Showing posts with the label Number

Java Square Root Cube Root Square and Cube of Number

Image
Java Square Root Cube Root Square and Cube of Number This code will take the users input and give the square root cube root square and cube of the number using Java. Java import java.util.*;  public class math {      public static void main(String args[]){         Scanner sc=new Scanner(System.in);          int num;     num=sc.nextInt();      System.out.println("Square Root of "+ num + " is: "+ Math.sqrt(num));      System.out.println("Cubed Root of "+ num + " is: "+ Math.cbrt(num));          System.out.println("Square of "+ num + " is: "+ Math.pow(num, 2));         System.out.println("Cube of "+ num + " is: "+ Math.pow(num, 3));         }} Click here to run this code More Free Code Examples: Java Code to Reverse a String Java Current Time and Date Pro...

C++ Code to Reverse a Number

Image
Reverse a Number using C++ * Featured Code Example Created by  tooselfish . C++ #include <iostream> int main() {     int a, b, c = 0;          // input a whole integer     // for example: 2485     std::cin >> b;          // for input failure     if( std::cin.fail() ){         std::cerr << "Wrong input!\n";         return 1;     }          std::cout << "Your number input : " << b << std::endl;          // reverse the input     while (b != 0){         a = b % 10;         c = ( c * 10 ) + a;         b = b / 10;     }          // output the reverse     std::cout << "The rev...

Java Code to Reverse a Number

Image
Reverse a Number using Java Java import java.util.Scanner;  class ReverseNumber {  public static void main(String args[]) {  int num=0;  int revnum =0;  System.out.println("Input your number and press enter: ");  Scanner in = new Scanner(System.in);  num = in.nextInt();  while( num != 0 ) {  revnum = revnum * 10;  revnum = revnum + num%10;  num = num/10; }  System.out.println("Reverse of input number is: "+revnum); } } 🎉CONGRATULATIONS YOU FOUND THE EASTER EGG!!!🎉 The winning message is "Talk is cheap. Show me the code." - Linus Torvalds 🤓 Click here to run this code More Free Code Examples: Java Code to Reverse a String Java Current Time and Date Program Javascript Easy Battleship Game