Posts

Showing posts from September, 2022

PL/SQL program to print a string and number |PL/SQL|

PL/SQL PL/SQL is a block structured language that can have multiple blocks in it Pl/SQL stands for "Procedural Language extension of SQL" that is used in Oracle. PL/SQL includes procedural language elements like conditions and loops. It allows declaration of constants and variables, procedures and functions, types and variables of those types and triggers. code: DECLARE name varchar(50):='Hello world'; reg_no varchar(20):='24'; BEGIN dbms_output.put_line('Name: '||name); dbms_output.put_line('Registered number: '||reg_no); END; / Code Explanation: dbms_output.put_line(): It is used for printing the output to the console screen. The DBMS_OUTPUT is a built-in package that enables you to display output, debugging information. The put_line is the most useful function to enable the package for the write data in the program.  Here the first line turns on serveroutput .  the SERVEROUTPUT setting controls whether SQL*Plus prints the output generate...

C PROGRAM TO FIND LEAP YEAR |LEAP YEAR|

Image
 C program to find leap year or not Code: #include<stdio.h> int main() { int year; printf("enter the year:"); scanf("%d",&year); if((year % 400==0)&&(!year % 100==0)||(year % 4==0)) {       printf("year %d is a leap year",year); } return 0; } Explanation: The user enter the year. The user entered year is stored in variable called "year" which is a integer datatype. We had used if statement to check whether the entered year is leap year or not. In if condition year%400=0 and ! year%100==0 or year%4=0 will be true only if both conditions are stratified. If the condition is true then it will print the year is leap year . If the condition is false then the printf statement won't be printed. It will come out of the condition. Output: