Google Search

Wednesday, October 12, 2011

Write a PL/SQL program to find the total and average of 4 subjects and display the grade


Write a PL/SQL program to find the total and average of 4 subjects and display the grade
declare
java number(10);
dbms number(10);
co number(10);
mfcs number(10);
total number(10);
avgs number(10);
per number(10);
begin
dbms_output.put_line('ENTER THE MARKS');
java:=&java;
dbms:=&dbms;
co:=&co;
mfcs:=&mfcsl;
total:=(java+dbms+co+mfcs);
per:=(total/600)*100;
if java<40 or dbms<40 or co<40 or mfcs<40 then
dbms_output.put_line('FAIL');
if per>75 then
dbms_output.put_line('GRADE A');
elsif per>65 and per<75 then
       dbms_output.put_line('GRADE B');
   elsif per>55 and per<65 then
               dbms_output.put_line('GRADE C');
else
dbms_output.put_line('INVALID INPUT');
end if;
dbms_output.put_line('PERCENTAGE IS '||per);
end;
/
OUTPUT:

SQL> @ GRADE.sql
Enter value for java: 80
old  11: java:=&java;
new  11: java:=80;
Enter value for dbms: 70
old  12: dbms:=&dbms;
new  12: dbms:=70;
Enter value for co: 89
old  13: co:=&co;
new  13: co:=89;
Enter value for mfcs: 71
old  14: mfcs:=&mfcs;
new  14: mfcs:=71;
GRADE A
PERCENTAGE IS 77
PL/SQL procedure successfully completed.

0 comments:

Post a Comment