Skip to content

Commit be987ca

Browse files
new update
1 parent ef206db commit be987ca

File tree

274 files changed

+8937
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+8937
-0
lines changed

.metadata/.lock

Whitespace-only changes.

.metadata/.log

Lines changed: 1412 additions & 0 deletions
Large diffs are not rendered by default.

.metadata/.mylyn/repositories.xml.zip

592 Bytes
Binary file not shown.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class SumofTwoArray {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub4
9+
System.out.println("Enter the size of array:\n");
10+
Scanner sc=new Scanner(System.in);
11+
int n=sc.nextInt();
12+
int arr1[]=new int[n];
13+
int arr2[]=new int[n];
14+
int sum[]=new int[n];
15+
for(int i=0; i<n; i++) {
16+
System.out.println("Enter the first array:\n");
17+
arr1[i]=sc.nextInt();
18+
}
19+
for(int i=0; i<n; i++) {
20+
System.out.println("Enter the second array:\n");
21+
arr2[i]=sc.nextInt();
22+
}
23+
for(int i=0; i<n; i++) {
24+
sum[i]=arr1[i]+arr2[i];
25+
}
26+
for(int i=0; i<n; i++) {
27+
System.out.println("sum of total array:\n"+" "+sum);
28+
}
29+
30+
}
31+
32+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.nit.core;
2+
3+
public class Armstrong {
4+
5+
public static void main(String[] args) {
6+
// TODO Auto-generated method stub
7+
8+
}
9+
10+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class Armstrong {
6+
7+
public static void main(String[] args) {
8+
Scanner sc=new Scanner(System.in);
9+
System.out.print("Enter a number: ");
10+
int number = sc.nextInt();
11+
if (isArmstrong(number)) {
12+
System.out.println(number + " is an Armstrong number.");
13+
} else {
14+
System.out.println(number + " is not an Armstrong number.");
15+
}
16+
17+
}
18+
public static boolean isArmstrong(int number) {
19+
int originalNumber = number;
20+
int numberOfDigits = String.valueOf(number).length();
21+
int sum = 0;
22+
23+
while (number > 0) {
24+
int digit = number % 10;
25+
sum += Math.pow(digit, numberOfDigits);
26+
number /= 10;
27+
}
28+
return sum == originalNumber;
29+
}
30+
31+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class ForLoop {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub
9+
int i, j; int num;
10+
Scanner sc=new Scanner(System.in);
11+
System.out.println("Enter a number\n");
12+
num= sc.nextInt();
13+
for(i=1; i<=10; i++) {
14+
System.out.println(num+"*"+i+"="+ num*i);
15+
16+
}
17+
}
18+
19+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.nit.core;
2+
3+
public class SumofTwoArray {
4+
5+
public static void main(String[] args) {
6+
// TODO Auto-generated method stub
7+
8+
}
9+
10+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class SumofTwoArray {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub4
9+
System.out.println("Enter the size of array:\n");
10+
Scanner sc=new Scanner(System.in);
11+
int n=sc.nextInt();
12+
int arr1[]=new int[n];
13+
int arr2[]=new int[n];
14+
int sum[]=new int[n];
15+
for(int i=0; i<n; i++) {
16+
System.out.println("Enter the first array:\n");
17+
arr1[i]=sc.nextInt();
18+
}
19+
for(int i=0; i<n; i++) {
20+
System.out.println("Enter the second array:\n");
21+
arr2[i]=sc.nextInt();
22+
}
23+
for(int i=0; i<n; i++) {
24+
sum[i]=arr1[i]+arr2[i];
25+
System.out.println("sum of array:\n"+" "+sum[i]);
26+
}
27+
28+
}
29+
30+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class SumofArray {
6+
7+
public static void main(String[] args) {
8+
int a;
9+
// TODO Auto-generated method stub
10+
Scanner sc= new Scanner(System.in);
11+
a[]=sc.nextInt();
12+
13+
}
14+
15+
}

.metadata/.plugins/org.eclipse.core.resources/.history/16/f094f9aee96f001f1817ae0e100a7d43

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class SumSeriesInputByUser {
6+
public static void main(String[] args) {
7+
double sum=0.0; int n;
8+
System.out.println("Enter a number");
9+
Scanner sc=new Scanner(System.in);
10+
n=sc.nextInt();
11+
for(int i=1; i>n; i++) {
12+
sum=sum+i;
13+
System.out.println(+sum);
14+
}
15+
}
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.nit.core;
2+
3+
public class SumSeriesInputByUser {
4+
public static void main(String[] args) {
5+
for(int i=1; i<=n; i++) {
6+
sum=+i;
7+
System.out.println(+sum);
8+
}
9+
}
10+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class SumofTwoArray {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub4
9+
int sum=0;
10+
System.out.println("Enter the size of array:\n");
11+
Scanner sc=new Scanner(System.in);
12+
int n=sc.nextInt();
13+
int arr1[]=new int[n];
14+
int arr2[]=new int[n];
15+
for(int i=0; i<n; i++) {
16+
System.out.println("Enter the first array:\n");
17+
arr1[i]=sc.nextInt();
18+
}
19+
for(int i=0; i<n; i++) {
20+
System.out.println("Enter the second array:\n");
21+
arr2[i]=sc.nextInt();
22+
}
23+
24+
for(int i=0; i<n; i++) {
25+
sum[i]=arr1[i]+arr2[i];
26+
27+
System.out.println(sum[i]);
28+
}
29+
30+
}
31+
32+
}

.metadata/.plugins/org.eclipse.core.resources/.history/1d/103e3a405370001f13efb6132910ec6a

Whitespace-only changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class SumofTwoArray {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub4
9+
System.out.println("Enter the size of array:\n");
10+
Scanner sc=new Scanner(System.in);
11+
int n=sc.nextInt();
12+
int arr1[]=new int[n];
13+
int arr2[]=new int[n];
14+
int sum[]=new int[n];
15+
for(int i=0; i<n; i++) {
16+
System.out.println("Enter the first array:\n");
17+
arr1[i]=sc.nextInt();
18+
}
19+
for(int i=0; i<n; i++) {
20+
System.out.println("Enter the second array:\n");
21+
arr2[i]=sc.nextInt();
22+
}
23+
for(int i=0; i<n; i++) {
24+
sum[i]=arr1[i]+arr2[i];
25+
}
26+
for(int i=0; i<n; i++) {
27+
System.out.println("sum of total array:\n"+" "+sum[i]);
28+
}
29+
30+
}
31+
32+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class PrimeNumber {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub
9+
int n, i;
10+
System.out.println("Enter a number\n");
11+
Scanner sc= new Scanner(System.in);
12+
n=sc.nextInt();
13+
if(checkPrime(n)) {
14+
System.out.println(+n +"number is prime");
15+
}
16+
else {
17+
System.out.println(+n +"number is not prime" );
18+
}
19+
}
20+
21+
private static boolean checkPrime(int n) {
22+
// TODO Auto-generated method stub
23+
if(n<=1) {
24+
return false;
25+
}
26+
for(i=2; i < Math.sqrt(n); i++) {
27+
if(n%i==0) {
28+
return false;
29+
}
30+
}
31+
return true;
32+
}
33+
34+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.nit.core;
2+
3+
public class ReverseNumber {
4+
public static void main(String[] args) {
5+
6+
}
7+
8+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class SumofTwoArray {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub4
9+
System.out.println("Enter the size of array:\n");
10+
Scanner sc=new Scanner(System.in);
11+
int n=sc.nextInt();
12+
int arr1[]=new int[n];
13+
int arr2[]=new int[n];
14+
for(int i=0; i<n; i++) {
15+
System.out.println("Enter the first array:\n");
16+
arr1[i]=sc.nextInt();
17+
}
18+
for(int i=0; i<n; i++) {
19+
System.out.println("Enter the second array:\n");
20+
arr2[i]=sc.nextInt();
21+
}
22+
}
23+
24+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class SumofTwoArray {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub4
9+
System.out.println("Enter the size of array:\n");
10+
Scanner sc=new Scanner(System.in);
11+
int n=sc.nextInt();
12+
int arr1[]=new int[n];
13+
int arr2[]=new int[n];
14+
int sum[]=new int[n];
15+
for(int i=0; i<n; i++) {
16+
System.out.println("Enter the first array:\n");
17+
arr1[i]=sc.nextInt();
18+
}
19+
for(int i=0; i<n; i++) {
20+
System.out.println("Enter the second array:\n");
21+
arr2[i]=sc.nextInt();
22+
}
23+
for(int i=0; i<n; i++) {
24+
sum[i]=(arr1[i]+arr2[i]);
25+
System.out.println("sum of array:\n"+" "+sum);
26+
}
27+
28+
}
29+
30+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.nit.core;
2+
3+
import java.util.Scanner;
4+
5+
public class SumofTwoArray {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub4
9+
System.out.println("Enter the size of array:\n");
10+
Scanner sc=new Scanner(System.in);
11+
int n=sc.nextInt();
12+
int arr1[]=new int[n];
13+
int arr2[]=new int[n];
14+
int sum[]=new int[n];
15+
for(int i=0; i<n; i++) {
16+
System.out.println("Enter the first array:\n");
17+
arr1[i]=sc.nextInt();
18+
}
19+
for(int i=0; i<n; i++) {
20+
System.out.println("Enter the second array:\n");
21+
arr2[i]=sc.nextInt();
22+
}
23+
for(int i=0; i<n; i++) {
24+
sum[i]=arr1[i];
25+
sum[i]=arr2[i];
26+
System.out.println("sum of array:\n"+" "+sum[i]);
27+
}
28+
29+
}
30+
31+
}

0 commit comments

Comments
 (0)