Skip to main content

Pl/sql imp program

Full course of c++ programming language

Click here > C++ programming language



1 ] print the message in pl/sql block. 

set serveroutput on;

begin

 dbms_output.put_line('Welcome to pl/sql world');

end;

/


==========================================

2 ] create a pl/sql block for print 1 to 10 numbers. 


set serveroutput on;

declare

 i number:=1;

begin

 while(i<=10)

  loop

   dbms_output.put_line(i);

   i:=i+1;

  end loop;

end;

/

==========================================

3 ] create a pl/sql block for print any message for number of time? 


set serveroutput on;

declare

 i number:=1;

begin

 while(i<=5)loop

  dbms_output.put_line('Hello world');

  i:=i+1;

 end loop;

end;

/


==========================================

4 ] create a pl/sql block for print the message for particular times? 

set serveroutput on;

declare

 msg varchar(25):=&message;

 n number:=&n;

 i number:=1;

begin

 while i<=n loop

  dbms_output.put_line(msg);

  i:=i+1;

 end loop;

end;

/


==========================================

6] create a pl/sql block for find the area of circle? 


set serveroutput on;

declare

 r number:=&radious;

 pi number:=3.14;

 ans number;

begin

 ans:=pi*r*r;

 dbms_output.put_line('The area of circle is '||ans);

end;

/


==========================================

7 ] create a pl /sql block for find the simple interest? 

set serveroutput on;

declare

 p number:=&p;

 r number:=&r;

 n number:=&n;

 si number;

begin 

 si:=(p*r*n)/100;

 dbms_output.put_line('The simple interest is '||si);

end;

/


==========================================

8 ]create a pl/sql block for check the number is positive, negative and zero? 

set serveroutput on;

declare

 n number:=&n;


begin 

 if(n>0) THEN

  dbms_output.put_line('Positive number');

 elsif(n=0) THEN

  dbms_output.put_line('Zero number');

 else

  dbms_output.put_line('Negative number');


 end if;

end;

/


==========================================

9 ] create a pl/sql block for print the fibbonacci series? 

set serveroutput on;

declare

 n number:=&n;

 a number:=0;

 b number:=1;

 c number;

 i number:=1;

begin

 while i<=5 loop

  dbms_output.put_line(a);

  c:=a+b;

  a:=b;

  b:=c;

  i:=i+1;

 end loop;

end;

/


==========================================

10 ] create a pl/sql block for print the multiplication table? 


set serveroutput on;

declare

 n number:=&n;

 i number:=1;

 ans number;

begin

 while(i<=10)loop

  ans:=n*i;

  dbms_output.put_line(n||'x'||i||'='||ans);

  i:=i+1;

 end loop;

end;

/


==========================================

11 ] Create a pl/sql block for check the number is prime or not? 


set serveroutput on;


declare

 n number:=&n;

 r number;

 s number;

 i number:=1;

 c number:=1;

begin

 s:=n;

 while(i!=n)loop

  if mod(n,i)=0 then

   c:=c+1;

  end if;

 i:=i+1;

 end loop;

 if c=2 then

  dbms_output.put_line('This number is prime');

 else

  dbms_output.put_line('This number is not a prime');

 end if;


end;

/



==========================================

12 ]Create a pl/sql block for find the number is armstrong Or not? 


set serveroutput on;

declare

 n number:=&n;

 temp number:=n;

 arm number:=0;

 r number;

begin

 while temp>0 loop

  r:=mod(temp,10);

  arm:=arm+(r*r*r);

  temp:=floor(temp/10); 

 end loop;

 dbms_output.put_line(arm);

 dbms_output.put_line(n);

 if n=arm then

  dbms_output.put_line('This number is armstrong');

 else

  dbms_output.put_line('This number is not a armstrong');

 end if;


end;

/


==========================================

13]Create a pl/sql block for find the factorial of number? 


set serveroutput on;


declare

 n number:=&n;

 i number:=n;

 fac number:=1; 

begin

 while(i>0)loop

  fac:=fac*i;

  i:=i-1;

 end loop;

 dbms_output.put_line('The factorial of '||n||'number is'||fac);


end;

/







Comments

Popular posts from this blog

Pratical -206 paper solution -3

Full course of c++ programming language Click here > C++ programming language Q-1 [A] Write a c program to create structure of employee with members Empid, EmpName, Qualification and EmpSalary by taking input of 5 employees display the employee whose qualification is "MBA" and salary greater than 20000 . #include <stdio.h> #include <conio.h> #include <string.h> struct Employee {     int Empid, EmpSalary;     char EmpName[50];     char Qualification[50]; }; Void main() {     struct Employee emp[5];     int i;     for (i = 0; i < 5; i++)     {         printf("Enter employee ID: ");         scanf("%d", &emp[i].Empid);         printf("Enter employee name: ");         scanf("%s", emp[i].EmpName);         printf("Enter employee qualification: ");         scanf("%s", emp[i].Quali...

9. Jumps Statement in c++

➢ Jumps in Loops:- ➢ C++ break and continue Statement:-                     There are two statements (break; and continue ;) built in C++ programming to alter the normal flow of program.                     Loops are used to perform repetitive task until test expression is false but sometimes it is desirable to skip some statement/s inside loop or terminate the loop immediately with checking test condition. On these type of scenarios, continue; statement and break; statement is used respectively. The break; statement is also used to terminate switch statement. 1) break Statement :-                       The break; statement terminates the loop(for, while and do..while loop) and switch statement immediately when it appears . Syntax of break :- break;              ...

C++ programming language

                c++ is a general programming language and is widely used nowadays for competitive programming. It has imperative, object-oriented and generic programming features.C++ runs on lots of platforms like Windows, Linux, Unix, Mac etc.   ❖❖  C++ with oops ❖❖