Skip to content

Commit d7d9d58

Browse files
authored
Add files via upload
1 parent dd404b3 commit d7d9d58

22 files changed

+506
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java.util.Scanner;
2+
public class Solution
3+
{
4+
public static void main(String[] args)
5+
{
6+
// write your code logic here !!
7+
Scanner sc = new Scanner(System.in);
8+
int b=sc.nextInt();
9+
for(int i=1;i<=b;i++)
10+
{
11+
for(int j=1;j<=b;j++)
12+
{
13+
char c=(char)(64+i);
14+
System.out.print(c);
15+
}
16+
System.out.println();
17+
}
18+
}
19+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import java.util.Scanner;
2+
3+
public class Solution {
4+
5+
public static void main(String[] args) {
6+
Scanner sc=new Scanner(System.in);
7+
int n=sc.nextInt();
8+
int m=(n+1)/2;
9+
int p=n/2;
10+
for(int i=1;i<=m;i++)
11+
{
12+
for(int j=1;j<=m-i;j++)
13+
{
14+
System.out.print(' ');
15+
}
16+
int r=2*i-1;
17+
for(int j=1;j<=r;j++)
18+
{
19+
System.out.print('*');
20+
}
21+
System.out.println();
22+
}
23+
for(int i=p;i>=1;i--)
24+
{
25+
for(int j=1;j<=p-i+1;j++)
26+
{
27+
System.out.print(' ');
28+
}
29+
int r=2*i-1;
30+
for(int j=1;j<=r;j++)
31+
{
32+
System.out.print('*');
33+
}
34+
System.out.println();
35+
}
36+
}
37+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import java.util.Scanner;
2+
public class Solution {
3+
4+
public static void main(String[] args) {
5+
6+
/* Your class should be named Solution.
7+
* Read input as specified in the question.
8+
* Print output as specified in the question.
9+
*/
10+
Scanner sc=new Scanner(System.in);
11+
int n=sc.nextInt();
12+
for(int i=1;i<=n;i++)
13+
{
14+
for(int j=n+1-i;j>=1;j--)
15+
{
16+
System.out.print(j+" ");
17+
}
18+
System.out.println();
19+
}
20+
for(int i=1;i<n;i++)
21+
{
22+
for(int j=i+1;j>=1;j--)
23+
{
24+
System.out.print(j+" ");
25+
}
26+
System.out.println();
27+
}
28+
}
29+
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import java.util.Scanner;
2+
public class Solution {
3+
public static void Print1(int n)
4+
{
5+
for(int i=1;i<=n;i++)
6+
{
7+
System.out.print(' ');
8+
}
9+
}
10+
public static void Print2(int n)
11+
{
12+
int res=(int)(Math.pow(11,(n-1)));
13+
while(res>0)
14+
{
15+
System.out.print(res%10+" ");
16+
res/=10;
17+
}
18+
}
19+
public static void main(String[] args) {
20+
// write your code logic !!
21+
Scanner sc=new Scanner(System.in);
22+
int n=sc.nextInt();
23+
for(int i=1;i<=n;i++)
24+
{
25+
Print1(n-i);
26+
Print2(i);
27+
System.out.println();
28+
}
29+
}
30+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import java.util.*;
2+
3+
4+
public class Solution
5+
{
6+
public static void main(String[] args) {
7+
Scanner sc = new Scanner(System.in);
8+
int n=sc.nextInt();
9+
for(int i=1;i<=n;i++)
10+
{
11+
char c=(char)(64+n);
12+
for(int j=1;j<=i;j++)
13+
{
14+
15+
System.out.print(c);
16+
c-=1;
17+
}
18+
System.out.println();
19+
}
20+
21+
}
22+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import java.util.Scanner;
2+
public class Solution {
3+
4+
5+
public static void main(String[] args) {
6+
7+
/* Your class should be named Solution.
8+
* Read input as specified in the question.
9+
* Print output as specified in the question.
10+
*/
11+
Scanner sc = new Scanner(System.in);
12+
int n=sc.nextInt();
13+
for(int i=1;i<=n;i++)
14+
{
15+
for(int j=1;j<=n-i;j++)
16+
{
17+
System.out.print(' ');
18+
}
19+
int r=2*i-1;
20+
for(int j=1;j<=r;j++)
21+
{
22+
System.out.print('*');
23+
}
24+
System.out.println();
25+
}
26+
}
27+
28+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import java.util.Scanner;
2+
3+
public class Main {
4+
5+
6+
public static void main(String[] args) {
7+
/* Your class should be named Main.
8+
* Read input as specified in the question.
9+
* Print output as specified in the question.
10+
*/
11+
12+
// Write your code here
13+
Scanner sc=new Scanner(System.in);
14+
int n=sc.nextInt();
15+
for(int i=1;i<=n;i++)
16+
{
17+
for(int j=i-1;j>=1;j--)
18+
{
19+
System.out.print(' ');
20+
}
21+
for(int j=i;j<=n;j++)
22+
{
23+
System.out.print(j);
24+
System.out.print(' ');
25+
}
26+
System.out.println();
27+
}
28+
29+
for(int i=1;i<n;i++)
30+
{
31+
for(int j=n-i-1;j>=1;j--)
32+
{
33+
System.out.print(' ');
34+
}
35+
for(int j=n-i;j<=n;j++)
36+
{
37+
System.out.print(j);
38+
System.out.print(' ');
39+
}
40+
System.out.println();
41+
}
42+
43+
}
44+
45+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import java.util.Scanner;
2+
public class Solution {
3+
public static void main(String[] args) {
4+
//Your code goes here
5+
Scanner sc = new Scanner(System.in);
6+
int n=sc.nextInt();
7+
for(int i=1;i<=n;i++)
8+
{
9+
for(int j=n-i+1;j<=n;j++)
10+
{
11+
char c=(char)(64+j);
12+
System.out.print(c);
13+
c+=1;
14+
}
15+
System.out.println();
16+
}
17+
}
18+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.Scanner;
2+
public class Solution {
3+
4+
5+
public static void main(String[] args) {
6+
7+
/* Your class should be named Solution.
8+
* Read input as specified in the question.
9+
* Print output as specified in the question.
10+
*/
11+
Scanner sc = new Scanner(System.in);
12+
int n=sc.nextInt();
13+
for(int i=1;i<=n;i++)
14+
{
15+
for(int j=n+1-i;j>=1;j--)
16+
{
17+
System.out.print(n+1-i);
18+
}
19+
System.out.println();
20+
}
21+
22+
}
23+
24+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import java.util.Scanner;
2+
import java.util.Scanner;
3+
4+
public class Solution {
5+
6+
public static void main(String[] args) {
7+
/* Your class should be named Solution.
8+
* Read input as specified in the question.
9+
* Print output as specified in the question.
10+
*/
11+
Scanner sc=new Scanner(System.in);
12+
int n=sc.nextInt();
13+
for(int i=1;i<=n;i++)
14+
{
15+
for(int j=1;j<=n-i;j++)
16+
{
17+
System.out.print(' ');
18+
}
19+
int k=i;
20+
for(int j=k;j<k+i;j++)
21+
{
22+
System.out.print(j);
23+
}
24+
int r=2*(i-1);
25+
int t=i-1;
26+
while(t>0)
27+
{
28+
System.out.print(r);
29+
r-=1;
30+
t-=1;
31+
}
32+
System.out.println();
33+
}
34+
}
35+
}

Week4/B-Test 1/GameOfAlphabet.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java.util.*;
2+
3+
4+
public class Solution
5+
{
6+
public static void main(String[] args) {
7+
8+
Scanner sc = new Scanner(System.in);
9+
int n=sc.nextInt();
10+
for(int i=1;i<=n;i++)
11+
{
12+
char c=64;
13+
for(int j=1;j<=i;j++)
14+
{
15+
c+=1;
16+
System.out.print(c+" ");
17+
}
18+
System.out.println();
19+
}
20+
}
21+
}

Week4/B-Test 1/NumberStarPattern1.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.Scanner;
2+
public class runner {
3+
4+
public static void main(String[] args) {
5+
// Write your code here
6+
Scanner sc=new Scanner(System.in);
7+
int n=sc.nextInt();
8+
for(int i=1;i<=n;i++)
9+
{
10+
for(int j=n;j>=1;j--)
11+
{
12+
if(i==j)
13+
{
14+
System.out.print("*");
15+
}
16+
else{
17+
System.out.print(j);
18+
}
19+
}
20+
System.out.println();
21+
}
22+
23+
}
24+
}

Week4/B-Test 1/SumOfEven&Odd.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import java.util.Scanner;
2+
class Solution {
3+
4+
public static void main(String args[]) {
5+
6+
// Write code here
7+
Scanner sc=new Scanner(System.in);
8+
int n=sc.nextInt();
9+
int even=0,odd=0;
10+
while(n>0)
11+
{
12+
int r=n%10;
13+
if(r%2==0)
14+
{
15+
even+=r;
16+
}
17+
else{
18+
odd+=r;
19+
}
20+
n/=10;
21+
}
22+
System.out.print(even+" "+odd);
23+
24+
}
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class Solution {
2+
public static double calculateCircleArea(double radius)
3+
{
4+
// write your logic here !!
5+
6+
double area=radius*radius*3.14159;
7+
return area;
8+
}
9+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public class Solution {
2+
public static int calculateSimple(int principal, double rate, int time) {
3+
return (int)((principal * rate * time) /100);
4+
}
5+
}

0 commit comments

Comments
 (0)