Factorial of large numbers
Codeamy
by
1y ago
In this example, You learn about Factorial of Large Number in java program.  Here you learn factorial of large numbers in Java, You are given a number and the task of the program to find factorial of large number. Factorial of Large Number Program in Java import java.util.Scanner;import java.math.BigInteger;public class BigFactorial{ public static void main(String args[]) { int n, c; BigInteger inc = new BigInteger("1"); BigInteger fact = new BigInteger("1"); Scanner input = new Scanner(System.in); System.out.println("Input an integer"); n = input.nextInt(); for (c ..read more
Visit website
Armstrong Number Program in Java
Codeamy
by
1y ago
In this example, You learn about an Armstrong Number in java program.  Here you learn an armstrong number in Java, You are given a number and the task of the program to check number is armstrong or not. Armstrong Number Program in Java import java.util.Scanner;public class ArmstrongNumber{ public static void main(String args[]) { int n, sum = 0, temp, remainder, digits = 0; Scanner in = new Scanner(System.in); System.out.println("Enter a number to check for Armstrong Number"); n = in.nextInt(); temp = n; // Count number of digits while (temp != 0) { digits ..read more
Visit website
Java Program Random Number Generator
Codeamy
by
1y ago
In this example, You learn about random number generator java. Here you learn Java program for random number generator, You are given a year and the task of the program to generate random number by making instance of random class. Random Number Generator in Java import java.util.Random;import java.util.Scanner;public class RandomNumber { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Random rand = new Random(); System.out.print("Please enter maximum range: "); int maxRange = scanner.nextInt(); for (int loop = 1 ..read more
Visit website
Leap Year Program in Java
Codeamy
by
1y ago
In this example, You learn about leap year program in Java Here you learn Java program for leap year, You are given a year and the task of the program to find given year is a leap year or not. Java Leap Year Program import java.util.Scanner;public class leapYear{ public static void main(String[] args) { try (Scanner scanner = new Scanner(System.in)) { System.out.print("Enter a Year:"); int year = scanner.nextInt(); boolean isLeap = false; if (year % 4 == 0) { if (year % 100 == 0) { if (year % 400 ..read more
Visit website
Find ASCII Value of a Character in C++
Codeamy
by
1y ago
 In this example, You learn about C++ program for find ASCII value of a character.  Here you learn find ASCII value in C++, You are given a character and the task of the program to find ASCII value of a character. C++ Program to find ASCII value of a Character #include <iostream>using namespace std;int main() { char ch,c; int cha; cout<<"Enter a character: "; cin>>ch; cha=ch; cout<<"\n ASCII value of "<<ch<<" is "<<cha; return 0;} Output Enter a character: F ASCII value of F is 70 ..read more
Visit website
Convert string to lowercase or uppercase in C++
Codeamy
by
1y ago
 In this example, You learn about C++ program for convert string to lower case and upper case.  Here you learn convert string to lower case and upper case in C++, You are given a string and the task of the program to find convert string to lower case and upper case. C++ Program for Convert String to Lower Case and Upper Case #include <iostream>using namespace std;void lowerString(string str){ for(int i=0;str[i]!='\0';i++) { if (str[i] >= 'A' && str[i] <= 'Z') //checking for uppercase characters str[i] = str[i] + 3 ..read more
Visit website
How is Java Platform Independent?
Codeamy
by
1y ago
In previous tutorial you learned about features of Java language but In this tutorial, We will provide justify of the feature Java Platform Independent. Our machine understand machine level language but it is not possible to write code in machine level language that's why we write code in human readable and then this source code is converted to machine level language. So, Computer can understand our instructions.  In C/C++ programming language the code is converted into machine language with the help of compilers and we get .exe file which is platform dependent and this m ..read more
Visit website
Java Program to find LCM of Two Numbers
Codeamy
by
1y ago
In this example, You learn about Java program to find LCM of two numbers. Here you learn find LCM of numbers in Java, You are given two numbers and the task of the program to find LCM/GCD in Java. LCM(Lowest Common Factor) A Lowest Common Factor of two numbers is the smallest positive number that is divisible by both numbers. Example, LCM of 10 and 15 is 30 because 30 is the lowest number divisible by both 10 and 15. GCD(Greatest Common Divisor/Highest Common Factor) A Greatest Common Divisor of two numbers is the largest positive number and non zero numbers that is divisi ..read more
Visit website
Java Program for Pythagorean Triples
Codeamy
by
1y ago
In this example, You learn about Java program for Pythagorean Triples.  Here you learn pythagorean triplet in Java, You are given a numbers and the task of the program to deduce whether the given numbers form a right angled triangle or not i.e. pythagorean triplet in Java. A Pythagorean Triples are the three positive integers a, b, and c such that a2 + b2 = c2. Here a id perpendicular, b is base and c is hypotenuse. Java Program for Pythagorean Triples import java.util.*;public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System ..read more
Visit website
Java Program to Remove Spaces from String
Codeamy
by
1y ago
In this example, You learn about Java program to remove spaces from string.  Here you learn Java remove spaces from string, You are given a string and the task of the program to remove spaces in Java. We use length() function to find a length of string and charAt() to find character at specific index.  To remove space we create new empty string and append each character from original string to this new string if find space ' ' then skip it to append (as space is treated as character). Then print the new string. Java Program to Remove Spaces from String import java.ut ..read more
Visit website

Follow Codeamy on FeedSpot

Continue with Google
Continue with Apple
OR