0% found this document useful (0 votes)
34 views52 pages

Print

Uploaded by

wrickm19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views52 pages

Print

Uploaded by

wrickm19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 52

1

ACKNOWLEDGEMENT

I would like to thank MS Baishali Sen for giving


me this opportunity to work on this wonderful
project. I would also like to thank my principal
MS Lola Shivshankar for assigning me this
wonderful project

2
INDEX PAGE
S.NO TOPIC PAGE NO.
1 PROGRAM USING ARITHMETIC OPERATORS
2 PROGRAM USING PROGRAM USING LOGICAL
OPERATORS
3 PROGRAM USING RELATIONAL OPERATORS
4 PROGRAM USING PRECEDENCE OF OPERATORS
5 PROGRAM USING PREFIX INCREMENT
6 PROGRAM USING IF STATEMENT
7 PROGRAM USING IF-ELSE STATEMENT
8 PROGRAM USINGIF-ELSE-IF
9 PROGRAM USING SWITCH PROGRAM
10 PROGRAM USINGTERNARY OPERATOR
11 USER DEFINED FUNCTIONS
12 PROGRAM USING SCANNER CLASS
13 PROGRAM USING OBJECT
14 PROGRAM USING IMPURE FUNCTIONS
15 PROGRAM USING STRING
16 PROGRAM USING NUM
17 PROGRAM USING PURE FUNCTIONS
18 PROGRAM USING LOCIC

3
19 PROGRAM USING MIN FUNCTION
20 PROGRAM USING MAX FUNCTION

4
COMPUTER PROJECT-1
UNIT 7- VARIABLES AND EXPRESSIONS
PROGRAM 1-Write a program using arithmetic operators

Variable Description Table


Variable Name Data Type Description

5
OUTPUT

PROGRAM 2
ALGORITHM-

1. Start

2. Enter (assigne) value of the variable (addend) X

3. Enter (assigne) value of the variable (addend) Y

4. Calculate Z (Z = X + Y)

5. Display result of addition, value of Z on the monitor with the message "The
sum of X and Y is:"

6. Ask the question "Do you want to re-start the program <Y / N>?" and set
value to the response variable ANSWER

7. If the ANSWER is "Yes," go to Step 1

8. If the ANSWER is "No," go to Step 9

9. End

6
WRITE A PROGRAM USING LOGICAL OPERATORS

7
Variable Description Table
Variable Name Data Type Description

OUTPUT-

int a = 9,b = 4, c;

8
c = a+b;
printf("a+b = %d \n",c);
c = a-b;
printf("a-b = %d \n",c);
c = a*b;
printf("a*b = %d \n",c);
c = a/b;
printf("a/b = %d \n",c);
c = a%b;

PROGRAM3
ALGORITHM-

9
WRITE A PROGRAM USING RELATIONAL OPERATORS

10
Variable Description Table
Variable Name Data Type Description

OUTPUT:-

PROGRAM 4
ALGORITHM-
1. Start

2. Enter (assigne) value of the variable (addend) X

3. Enter (assigne) value of the variable (addend) Y

4. Calculate Z (Z = X + Y)

11
Input − The precedence relations from some operator precedence grammar and an input
string of terminals from that grammar.
Output − There is no output but it can construct a skeletal parse tree as we parse, with one
non-terminal labeling all interior nodes and the use of single productions not shown.
Alternatively, the sequence of shift-reduce steps can be considered the output.

WRITE A PROGRAM USING THE PRECEDENCE OF OPERATORS

12
Variable Description Table
Variable Name Data Type Description

OUTPUT-

13
PROGRAM 5-
ALGORITHM-

Start
Enter java io package
Enter input
Ask input
print

14
Start
Enter java io package
Enter input
Ask input
Print the statement
end

WRITE A PROGRAM USING PREFIX INCREMENT OPERATOR

15
16
Variable Description Table
Variable Name Data Type Description

OUTPUT-

17
UNIT 8-Conditional Statesments
PROGRAM 1- IF STATEMENT
ALGORITHM-

Start
Import java io oackage
Use int
Enter input
Use if statement
Ask user for inout
Print the final statement
end

18
Variable Description Table
Variable Name Data Type Description

OUTPUT-

PROGRAM 2 IF-ELSE-STATEMENT
ALGORITHM-

Start
Import java io oackage
Use int
Enter input
Use if-else statement
Ask user for inout
19
Print the final statement
end

Variable Description Table


Variable Name Data Type Description

OUTPUT-

20
PROGRAM 3 IF-ELSE-IF PROGRAM-

ALGORITHM-

Start
Import java io oackage
Use int
Enter input
Use if-else-if statement
Ask user for inout
Print the final statement
end

21
Variable Description Table
Variable Name Data Type Description

22
OUTPUT-

PROGRAM 4 SWITCH PROGRAM-


WRITE A PROGRAM TO INPUT DAY AND PRINT DAY NAME.

ALGORITHM-
tep 1: Start. Step 2: Take two inputs (a and b) from the user. Step 3: If a is greater than b
then go to step 4 otherwise go to step 5 Step 4: Print a greater than b Step 5: Print b
greater than a Step 6: Stop.

23
Variable Description Table
Variable Name Data Type Description

24
OUTPUT-

PROGRAM 5-PROGRAM WITH TERNARY OPERATOR


ALGORITHM-

Start
Insert java io package
int a = 10, b = 20, c; if (a < b) { c = a; } else { c = b; } printf("%d", c).
end

25
Variable Description Table
Variable Name Data Type Description

OUTPUT

26
27
UNIT 9- USER DEFINED FUNCTIONS
PROGRAM 1-

ALGORITHM-

28
29
Variable Description Table
Variable Name Data Type Description

PROGRAM-2
ALGORITHM-

30
Variable Description Table
Variable Name Data Type Description

31
PROGRAM 3
ALGORITHM-

32
33
Variable Description Table
Variable Name Data Type Description

34
PROGRAM 4
ALGORITHM-

35
Variable Description Table
Variable Name Data Type Description

36
OUTPUT

PROGRAM 5

37
Variable Description Table
Variable Name Data Type Description

38
UNIT 10-ARRAYS
PROGRAM 1
ALGORITHM-
START
 Traverse − print all the array elements one by one.
 Insertion − Adds an element at the given index.
 Deletion − Deletes an element at the given index.
 Search − Searches an element using the given index or by the value.

end

39
OUTOUT

Variable Description Table


Variable Name Data Type Description

40
41
PROGRAM 2
ALGORITHM-

42
Variable Description Table
Variable Name Data Type Description

OUTPUT

43
PROGRAM 3
ALGORITHM-

44
Variable Description Table
Variable Name Data Type Description

OUTPUT

45
46
PROGRAM 4
ALGORITHM-

47
OUTPUT

48
Variable Description Table
Variable Name Data Type Description

49
PROGRAM 5
ALGORITHM-

50
51
Variable Description Table
Variable Name Data Type Description

OUTPUT

52

You might also like