PALINDROMIC Pattern with Numbers pattern
Code :
ASDF...
PALINDROMIC Pattern with Numbers pattern
Code :
ASDF...
Prime In Range Code:
Prime Number 1 to 999:
Output:
java .\PrintPrimeRange.java
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997
Optimized Function: Check if a number is Prime or not Java code: 🧊
java .\CheckPrimeOptimized.java
true
false
Call by value Example using java programming code
Product of a and b
Factorial Function
I love u bby ðŸ¤
fghd
Find Binomial Coefficient using Factorial Function Java Programming Code
ðŸ¤
Function Overloading using Parameters, Java Programming Code
Data Types: Function Overloading using Data Types
Check if a number is Prime or not Function Code:
java .\PrimeNumF1.java
true
Output of Code:
Java Code:
Output:
Simple Java Code:...
java .\printCharacterPatternHalfPyramid.java
A
BC
DEF
GHIJ
KLMNO
PQRSTU
This is Half Pyramid image, but in programming: this code is not fixed name, it's used to just define this code.
Half Pyramid Pattern Java Code:
Output:
java .\HalfPyramid.java
1
12
123
1234
12345
123456
1234567
12345678
123456789
12345678910
1234567891011
Using Nested Loop Inverted Star Pattern
Output:
7
*******
******
*****
****
***
**
*
Simple Java Code for Star Pattern.
Output:
java .\StarPatternUsingNastedLoops.java
7
*
**
***
****
*****
******
*******
filename = MultiplicationTable.java
filename: MultiTest.java
filename: printMultiplicationTable.java
Output of program:
Loops> java .\MultiplicationTable.java
Enter number: 5
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50
import java.util.Scanner;
public class ReadSetofIntegersPrintsSumofEvenAndOddIntegers {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int number, chioce, evenSum = 0, OddSum = 0;
do {
System.out.print("Enter the number ");
number = sc.nextInt();
if (number % 2 == 0) {
evenSum += number;
} else {
OddSum += number;
}
System.out.println("Do you want to continue? Press 1 for yes or 0 for no");
chioce = sc.nextInt();
} while (chioce == 1);
System.out.println("Sum of even numbers: " + evenSum);
System.out.println("Sum of odd numbers: " + OddSum);
}
}
import java.util.Scanner;
public class PrimeNumberCheck {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
boolean isPrime = true;
for (int i = 2; i <= n - 1; i++) {
if (n % i == 0) { // n is multiple of i (i not equal to 1 or n)
isPrime = false;
}
}
if (isPrime == true) {
System.out.print(n + " is prime number");
} else {
System.out.print(n + " is not prime number");
}
}
}
import java.util.Scanner;
public class KeepEnteringNumbersTillUserEntersMultipleOf {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
do {
System.out.println("Enter your Number : ");
int num = sc.nextInt();
if (num % 10 == 0) {
break;
}
System.out.println(num);
} while (true);
}
}
import java.util.Scanner;
public class ReverseTheGivennNumber {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
int rev = 0;
while (num > 0) {
int lastDigit = num % 10;
rev = (rev * 10) + lastDigit;
num /= 10;
}
System.out.println(rev);
}
}
import java.util.Scanner;
public class ReverseOfNumber {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in); // use for input from user
int num = sc.nextInt();
// int num = 10899;
while (num > 0) {
int lastDigit = num % 10;
System.out.print(lastDigit);
num = num / 10; // n/10;
}
System.out.println();
}
}
import java.util.*;
//Print Square pattern
public class squarePattern {
public static void main(String args[]) {
// for (int lines = 1; lines <= 4; lines++)
// System.out.println("****");
int lines = 1;
while (lines <= 4) {
System.out.println("****");
lines++;
}
}
}
import java.util.Scanner;
// Sum of first N natural Numbers , Naymul Islam CSE 18
public class sumofN {
public static void main(String args[]) {
System.out.print("Enter Natural Number: ");
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int sum = 0;
int i = 1;
while (i <= n) {
sum += i;
i++;
}
// System.out.println(sum);
System.out.println("Sum of first " + n + " natural Numbers: " + sum);
}
}
import java.util.Scanner;
public class WhileLoop {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int counter = 1;
while (counter <= n) {
System.out.println("I Love You " + counter);
counter++;
}
System.out.println(n + " times I love you print.");
}
}
Code of: Max Sub Array Sum: Kadane's Algorithm. public class MaxSubArraySumKadanesALgorithm { public static void Kadane ( int ...