WAP to print the 10 different circle using loop.
set serveroutput on
declare
area number;
begin
area:=2;
while area <=10 loop
dbms_output.put_line('The Area is '||3.14 * area * area);
area := area+2 ;
end loop;
end;
Results
The Area is 12.56
The Area is 50.24
The Area is 113.04
The Area is 200.96
The Area is 314
The Area is 452.16
The Area is 615.44
The Area is 803.84
The Area is 1017.36
The Area is 1256
PL/SQL procedure successfully completed.
Write a program to accept a number and print it in reverse order?
set serveroutput on
DECLARE
A number;
Rev number;
R number;
begin
A:=&A;
Rev:=0;
R:=0;
WHILE A !=0 loop
R:=mod(A,10);
Rev:=Rev*10+R;
A:=trunc(A/10);
end LOOP;
dbms_output.put_line('The Reverse of a Given Number is '||Rev);
end;
Results
old 6: A:=&A;
new 6: A:=567;
The Reverse of a Given Number is 765
PL/SQL procedure successfully completed.
Write to print the Table of any number enter by user?
set serveroutput on
declare
N number;
i number;
begin
n:=&n;
i:=1;
dbms_output.put_line('Table of'||N);
while i<=10 loop
dbms_output.put_line(N*i);
i:=i+1;
end loop;
end;
Results
old 5: n:=&n;
new 5: n:=4;
Table of4
4
8
12
16
20
24
28
32
36
40
PL/SQL procedure successfully completed.
WAP to print the digit of a number in reverse order?
set serveroutput on
DECLARE
A number;
Rev number;
R number;
begin
A:=&A;
Rev:=0;
R:=0;
WHILE A>0 loop
R:=A mod 10;
Rev:=Rev*10+R;
A:=trunc(A/10);
end LOOP;
dbms_output.put_line('The Reverse of a Given Number is '||Rev);
end;
Results
old 6: A:=&A;
new 6: A:=456;
The Reverse of a Given Number is 654
PL/SQL procedure successfully completed.
WAP to print the square of 10 numbers using loop?
set serveroutput on
declare
A number;
square number;
begin
A:=1;
while A<11 loop
dbms_output.put_line('Square of A:'||square);
A:=A+1;
square:=A*A;
End loop;
End;
Results
Square of A:
Square of A:4
Square of A:9
Square of A:16
Square of A:25
Square of A:36
Square of A:49
Square of A:64
Square of A:81
Square of A:100
PL/SQL procedure successfully completed.
WAP to print the Cube of 10 numbers using loop?
set serveroutput on
declare
A number;
cube number;
begin
A:=1;
while A<11 loop
dbms_output.put_line('Cube of A:'||cube);
A:=A+1;
cube:=A*A*A;
End loop;
End;
WAP to print the Average Marks of 5 Student using loop?
set serveroutput on
DECLARE
S1 number;
S2 number;
S3 number;
S4 number;
S5 number;
i number;
Average number;
total number;
begin
i:=1;
while i<=10 loop
S1:=&S1;
S2:=&S2;
S3:=&S3;
S4:=&S4;
S5:=&S5;
total:=S1+S2+S3+S4+S5;
Average:=total/5;
i:=i+1;
end loop;
dbms_output.put_line('Average'||Average);
end;
Results
old 13: S1:=&S1;
new 13: S1:=78;
old 14: S2:=&S2;
new 14: S2:=78;
old 15: S3:=&S3;
new 15: S3:=66;
old 16: S4:=&S4;
new 16: S4:=45;
old 17: S5:=&S5;
new 17: S5:=45;
Average62.4
PL/SQL procedure successfully completed.
Write the program to print the First 20 Number.
set serveroutput on
declare
A number;
begin
A:=1;
while A<20 loop
dbms_output.put_line('Value of A:'||A);
A:=A+1;
End loop;
End;
Results
Value of A:1
Value of A:2
Value of A:3
Value of A:4
Value of A:5
Value of A:6
Value of A:7
Value of A:8
Value of A:9
Value of A:10
Value of A:11
Value of A:12
Value of A:13
Value of A:14
Value of A:15
Value of A:16
Value of A:17
Value of A:18
Value of A:19
PL/SQL procedure successfully completed.
Write the program to print the First 20 Even Number.
set serveroutput on
declare
A number;
begin
A:=2;
while A<40 loop
dbms_output.put_line('Even Number of A:'||A);
A:=A+2;
End loop;
End;
Results
Even Number of A:2
Even Number of A:4
Even Number of A:6
Even Number of A:8
Even Number of A:10
Even Number of A:12
Even Number of A:14
Even Number of A:16
Even Number of A:18
Even Number of A:20
Even Number of A:22
Even Number of A:24
Even Number of A:26
Even Number of A:28
Even Number of A:30
Even Number of A:32
Even Number of A:34
Even Number of A:36
Even Number of A:38
PL/SQL procedure successfully completed.
Write the program to print the First 20 Odd Number.
set serveroutput on
declare
A number;
begin
A:=1;
while A<40 loop
dbms_output.put_line('Odd Number of A:'||A);
A:=A+2;
End loop;
End;
Results
Odd Number of A:1
Odd Number of A:3
Odd Number of A:5
Odd Number of A:7
Odd Number of A:9
Odd Number of A:11
Odd Number of A:13
Odd Number of A:15
Odd Number of A:17
Odd Number of A:19
Odd Number of A:21
Odd Number of A:23
Odd Number of A:25
Odd Number of A:27
Odd Number of A:29
Odd Number of A:31
Odd Number of A:33
Odd Number of A:35
Odd Number of A:37
Odd Number of A:39
PL/SQL procedure successfully completed.
Write to print the sum of first 20 Even Number.
set serveroutput on
declare
A number;
S number;
begin
A:=2;
S:=0;
while A<40 loop
A:=A+2;
S:=S+A;
End loop;
dbms_output.put_line('Sum of A:'||S);
End;
Results
Sum of A:418
PL/SQL procedure successfully completed.
set serveroutput on
declare
area number;
begin
area:=2;
while area <=10 loop
dbms_output.put_line('The Area is '||3.14 * area * area);
area := area+2 ;
end loop;
end;
Results
The Area is 12.56
The Area is 50.24
The Area is 113.04
The Area is 200.96
The Area is 314
The Area is 452.16
The Area is 615.44
The Area is 803.84
The Area is 1017.36
The Area is 1256
PL/SQL procedure successfully completed.
set serveroutput on
DECLARE
A number;
Rev number;
R number;
begin
A:=&A;
Rev:=0;
R:=0;
WHILE A !=0 loop
R:=mod(A,10);
Rev:=Rev*10+R;
A:=trunc(A/10);
end LOOP;
dbms_output.put_line('The Reverse of a Given Number is '||Rev);
end;
Results
old 6: A:=&A;
new 6: A:=567;
The Reverse of a Given Number is 765
PL/SQL procedure successfully completed.
Write to print the Table of any number enter by user?
set serveroutput on
declare
N number;
i number;
begin
n:=&n;
i:=1;
dbms_output.put_line('Table of'||N);
while i<=10 loop
dbms_output.put_line(N*i);
i:=i+1;
end loop;
end;
Results
old 5: n:=&n;
new 5: n:=4;
Table of4
4
8
12
16
20
24
28
32
36
40
PL/SQL procedure successfully completed.
WAP to print the digit of a number in reverse order?
set serveroutput on
DECLARE
A number;
Rev number;
R number;
begin
A:=&A;
Rev:=0;
R:=0;
WHILE A>0 loop
R:=A mod 10;
Rev:=Rev*10+R;
A:=trunc(A/10);
end LOOP;
dbms_output.put_line('The Reverse of a Given Number is '||Rev);
end;
Results
old 6: A:=&A;
new 6: A:=456;
The Reverse of a Given Number is 654
PL/SQL procedure successfully completed.
WAP to print the square of 10 numbers using loop?
set serveroutput on
declare
A number;
square number;
begin
A:=1;
while A<11 loop
dbms_output.put_line('Square of A:'||square);
A:=A+1;
square:=A*A;
End loop;
End;
Results
Square of A:
Square of A:4
Square of A:9
Square of A:16
Square of A:25
Square of A:36
Square of A:49
Square of A:64
Square of A:81
Square of A:100
PL/SQL procedure successfully completed.
WAP to print the Cube of 10 numbers using loop?
set serveroutput on
declare
A number;
cube number;
begin
A:=1;
while A<11 loop
dbms_output.put_line('Cube of A:'||cube);
A:=A+1;
cube:=A*A*A;
End loop;
End;
WAP to print the Average Marks of 5 Student using loop?
set serveroutput on
DECLARE
S1 number;
S2 number;
S3 number;
S4 number;
S5 number;
i number;
Average number;
total number;
begin
i:=1;
while i<=10 loop
S1:=&S1;
S2:=&S2;
S3:=&S3;
S4:=&S4;
S5:=&S5;
total:=S1+S2+S3+S4+S5;
Average:=total/5;
i:=i+1;
end loop;
dbms_output.put_line('Average'||Average);
end;
Results
old 13: S1:=&S1;
new 13: S1:=78;
old 14: S2:=&S2;
new 14: S2:=78;
old 15: S3:=&S3;
new 15: S3:=66;
old 16: S4:=&S4;
new 16: S4:=45;
old 17: S5:=&S5;
new 17: S5:=45;
Average62.4
PL/SQL procedure successfully completed.
Write the program to print the First 20 Number.
set serveroutput on
declare
A number;
begin
A:=1;
while A<20 loop
dbms_output.put_line('Value of A:'||A);
A:=A+1;
End loop;
End;
Results
Value of A:1
Value of A:2
Value of A:3
Value of A:4
Value of A:5
Value of A:6
Value of A:7
Value of A:8
Value of A:9
Value of A:10
Value of A:11
Value of A:12
Value of A:13
Value of A:14
Value of A:15
Value of A:16
Value of A:17
Value of A:18
Value of A:19
PL/SQL procedure successfully completed.
Write the program to print the First 20 Even Number.
set serveroutput on
declare
A number;
begin
A:=2;
while A<40 loop
dbms_output.put_line('Even Number of A:'||A);
A:=A+2;
End loop;
End;
Results
Even Number of A:2
Even Number of A:4
Even Number of A:6
Even Number of A:8
Even Number of A:10
Even Number of A:12
Even Number of A:14
Even Number of A:16
Even Number of A:18
Even Number of A:20
Even Number of A:22
Even Number of A:24
Even Number of A:26
Even Number of A:28
Even Number of A:30
Even Number of A:32
Even Number of A:34
Even Number of A:36
Even Number of A:38
PL/SQL procedure successfully completed.
Write the program to print the First 20 Odd Number.
set serveroutput on
declare
A number;
begin
A:=1;
while A<40 loop
dbms_output.put_line('Odd Number of A:'||A);
A:=A+2;
End loop;
End;
Results
Odd Number of A:1
Odd Number of A:3
Odd Number of A:5
Odd Number of A:7
Odd Number of A:9
Odd Number of A:11
Odd Number of A:13
Odd Number of A:15
Odd Number of A:17
Odd Number of A:19
Odd Number of A:21
Odd Number of A:23
Odd Number of A:25
Odd Number of A:27
Odd Number of A:29
Odd Number of A:31
Odd Number of A:33
Odd Number of A:35
Odd Number of A:37
Odd Number of A:39
PL/SQL procedure successfully completed.
Write to print the sum of first 20 Even Number.
set serveroutput on
declare
A number;
S number;
begin
A:=2;
S:=0;
while A<40 loop
A:=A+2;
S:=S+A;
End loop;
dbms_output.put_line('Sum of A:'||S);
End;
Results
Sum of A:418
PL/SQL procedure successfully completed.
No comments:
Post a Comment