RDBMS SOLUTION
ASSIGNMENT 1
SET B Q.3 SOLUTION
Write a PL/SQL block which will display ‘FYBBA(CA)’ ten times on screen. Odd index number must display ‘FYBBA(CA)’ and even index number position in reverse case ‘fybba(ca)’.
Source code:
/*set b Q.3
in this we will use simple exit loop
and also using simple if else statement we can identify even or odd*/
/*declaration section*/
declare
i number:=1; /*this will increment in loop*/
begin
loop
if(mod(i,2)=0)then /*mod(i,2)=0 means if (i mod by 2=0)*/
dbms_output.put_line(i||'Even fybba(ca)');
else
dbms_output.put_line(i||'Odd FYBBA(CA)');
end if;
i:=i+1;/*for incrementing*/
exit when(i=11);
end loop;
end;
0 Comments