# Introduction%20To%20Programming%20Information%20Technology%20,%201 - PowerPoint PPT Presentation

View by Category
Title:

## Introduction%20To%20Programming%20Information%20Technology%20,%201

Description:

### MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Using Java Lecture 11 Repetition Statements Practices – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 19
Provided by: OneWay2Allah
Category:
Tags:
Transcript and Presenter's Notes

Title: Introduction%20To%20Programming%20Information%20Technology%20,%201

1
Introduction To Programming Information
Technology , 1st Semester
MINISTRY OF EDUCATION HIGHER EDUCATION COLLEGE
OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE
• Using Java

Lecture 11 Repetition Statements Practices
Teacher Mahmoud Rafeek Alfarra
2
Practice 1
• Identify and correct the errors in each of the
following pieces of code.
• int x 1,
• total
• while ( x lt 10 )
• total x x

3
Practice 1
• Identify and correct the errors in each of the
following pieces of code.
• while ( x lt 100 )
• total x
• x
• while ( y gt 0 )
• System.out.println( y )
• y

4
Practice 1
• Identify and correct the errors in each of the
following pieces of code.
• for ( i 100, i gt 1, i )
• System.out.println( i )
• The following code should output the odd integers
from 19 to 1
• for ( i 19 i gt 1 i 2 )
• System.out.println( i )

5
Practice 1
• Identify and correct the errors in each of the
following pieces of code.
• The following code should print whether integer
value is odd or even
• switch ( value 2 )
• case 0
• System.out.println( "Even integer" )
• case 1
• System.out.println( "Odd integer" )

6
Practice 1
• Identify and correct the errors in each of the
following pieces of code.
• The following code should output the even
integers from 2 to 100
• counter 2
• do
• System.out.println( counter )
• counter 2
• While ( counter lt 100 )

7
Practice 2
• Trace the following program

8
Practice 3
• Trace the following program

9
Practice 3
• Trace the following program

10
Practice 4
• Trace the following program

11
Practice 5
• Trace the following program

12
Practice 5
• Trace the following program

13
Practice 6
• Write an application that finds the smallest of
several integers. Assume that the first value
read specifies the number of values to input from
the user.

14
Practice 7
• Write an application that calculates the product
of the odd integers from 1 to 15.

15
Practice 8
• Write an application that prints the following
diamond shape. You may use output statements that
print a single asterisk (), a single space or a
single newline character. Maximize your use of
repetition, and minimize the number of output
statements.

16
More Practices
• More practices in the text book, chapters 4 and 5

17
Emank X Mezank
• ?? ???? ??????? ???? ???? ???? ??????? ?????? ??
• ??? ????

18
Next
• Practices