-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLabTask2
179 lines (123 loc) · 2.59 KB
/
LabTask2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
//# LabTask
import java.util.*;
public class task1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
/*******************************************************************
*
* Task 1.................
*/
Scanner Input= new Scanner(System.in);
/*System.out.println(" Enter the percentage of Student :");
int num= Input.nextInt();
if (num >= 90)
{
System.out.println("A Grade");
}
else if (num>=75)
{
System.out.println(" B Grade");
}
else if (num>=65)
{
System.out.println("C Grade");
}
else if (num>=50)
{
System.out.println("D Grade");
}
else
{
System.out.println("Fail");
}
*/
/*****************************************/
/* System.out.println("Input the Grade of Student");
String grade = Input.nextLine();
switch(grade)
{
case "A" : System.out.println(" Your percentage is 90");
break;
case "B" : System.out.println(" Your Percentage is 75");
break;
case "C": System.out.println("Your Percentage is 65 ");
break;
case "D": System.out.println("Your Percentage is 50");
break;
default: System.out.println("You are Fail");
}
*/
/*********************\\\\\\\
*
* Task 2
*
*
*/
/*
for (int i=0; i<100; i++)
{
//System.out.println("Enter the Number for which you check the divisibility :");
//int i = Input.nextInt();
if (i <=100 && i >=1)
{
if (i%3==0 && i%5==0)
{
System.out.println( i +" AlphaBeta ");
}else if(i%5==0)
{
System.out.println( i + " Beta");
}else if(i%3==0)
{
System.out.println(i + " Alpha");
}else
{
// Empty
}
}
}
*/
/***********
*
*
* Task 3
*
*
*/
/* System.out.print("Enter the number :");
int num2= Input.nextInt();
int sum=0;
System.out.println("The Inverse is :");
if (num2>1)
{
for(int i=num2; i>=1; --i)
{
System.out.print(" "+ i);
sum+=(i*i);
}
}else
{
System.out.println("Please Enter the number greater than 1");
}
System.out.println();
System.out.println("The Sum is " + sum);
*/
/************
*
* Task 4
*
*/
int []array= {1,2,3,4,5,6,7,8,9};
System.out.print("The Origional Array is [ ");
for(int i=0; i<array.length; i++)
{
System.out.print(" " + array[i]);
}
System.out.print(" ] \n The Reverse array is " );
System.out.print("[");
for(int i=array.length-1; i>=0; --i)
{
System.out.print(" " + array[i]);
}
System.out.println(" ]");
}
}