Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tutoria_Examples_T03
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mahboobe Shakeri
Tutoria_Examples_T03
Commits
de001b33
Commit
de001b33
authored
6 months ago
by
Mahboobe Shakeri
Browse files
Options
Downloads
Patches
Plain Diff
adding loops and conditions
parent
f432a4e1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Main.java
+90
-11
90 additions, 11 deletions
src/Main.java
with
90 additions
and
11 deletions
src/Main.java
+
90
−
11
View file @
de001b33
...
...
@@ -5,18 +5,97 @@ public class Main {
public
static
void
main
(
String
[]
args
)
{
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
System
.
out
.
println
(
"Hello Mahboobe local!"
);
int
Mynumber
=
25
;
System
.
out
.
println
(
"your number is : "
+
Mynumber
);
//sep 18
for
(
int
i
=
0
;
i
<
6
;
i
++){
System
.
out
.
println
(
i
);
}
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Enter your name: "
);
String
name
=
sc
.
nextLine
();
System
.
out
.
println
(
"Enter your age: "
);
int
age
=
sc
.
nextInt
();
System
.
out
.
println
(
"Enter your height: "
);
int
height
=
sc
.
nextInt
();
System
.
out
.
println
(
"Your name is "
+
name
+
" and age is "
+
age
+
" and height is "
+
height
);
int
number
=
3
;
// do{
// System.out.println("Enter positive number:");
// number= sc.nextInt();
//
// }while(number>0);
int
sum
=
0
;
while
(
number
>
0
){
System
.
out
.
println
(
"Enter positive number:"
);
number
=
sc
.
nextInt
();
sum
+=
number
;
}
System
.
out
.
println
(
"The sum is: "
+
sum
);
sc
.
close
();
// int i=0;
// while(i<6){
// System.out.println(i);
// i++;
// }
// int day = 2;
// switch (day) {
// case 1:
// System.out.println("Monday");
// break;
// case 2:
// System.out.println("Tuesday");
// break;
// case 3:
// System.out.println("Wednesday");
// break;
// case 4:
// System.out.println("Thursday");
// break;
// default:
// System.out.println("Invalid day");
// }
// String fruit = "orange";
// switch (fruit) {
// case "apple":
// System.out.println("You chose an apple.");
// break;
// case "banana":
// System.out.println("You chose a banana.");
// break;
// case "orange":
// System.out.println("You chose an orange.");
// break;
// default:
// System.out.println("Unknown fruit");
// }
// int age =
// 7;
// if( age >= 18){
// System.out.println("You are an adult");
// }else if(age > 12){
// System.out.println("You are a teenager");
// }else{
// System.out.println("You are a child");
// }
// System.out.println("Hello Mahboobe local!");
// int Mynumber = 25;
// System.out.println("your number is : " + Mynumber);
// Scanner sc = new Scanner(System.in);
// System.out.println("Enter your name: ");
// String name = sc.nextLine();
// System.out.println("Enter your age: ");
// int age = sc.nextInt();
//
// System.out.println("Enter your height: ");
// int height = sc.nextInt();
// System.out.println("Your name is " + name + " and age is " + age + " and height is " + height);
// sc.close();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment