NevLabs

Under Construction

NevLabs

Under Construction

NevLabs

Under Construction

NevLabs

Under Construction

NevLabs

Under Construction

Thursday, October 20, 2011

Single inheritance program using C++


#include<iostream>
using namespace std;
class base
{
public:
int m;
void get_m()
{
cout<<"\n\n\t\tEnter the value of m :";
cin>>m;
}
void disp()
{
cout<<"\n\n\t\tm :"<<m;
}
};
class derived:public base
{
public:
int n,sum;
void get()
{
cout<<"\n\n\t\tEnter the value of n:";
cin>>n;
}

Tuesday, October 11, 2011

Program using C to calculate Electricity Bill with if-else condition


Conditions      
                <=100 Rs.4/units
                 > 100 and <=300 Rs.4.50/units
                 >300 and <=500 Rs.4.75/units
                 >500 Rs.5/units

Program
#include<stdio.h>
#include<conio.h>
void main ()
{
  int unit, tot;
  clrscr ();
  printf("Enter Total Units:");
  scanf ("%d", &unit);
   if (unit<=100)
     {
      tot=unit*4;
     }
   else if (unit>100 && unit<=300)
     {
      tot=unit*4.5;
     }

Multiplication Table Using C


#include <stdio.h>
#include <conio.h>
 void main()
{
   Int i,n,num;
  clrscr();
  printf(“Enter the number to print multiplication table :”);
  scanf(“%d”,&num);
  printf(“how many terms :”);
  scanf(“%d”,&n);
  clrscr();
  printf(“======MULTIPLICATION TABLE=======\n             ”);
  for(i=1;i<=n;i++);
  printf(“%d*%d=%3d”,i,num,i*num);
  getch();
}

C program to display perfect,abudent,and deficiant numbers


#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<math.h>
int test(int n);
void main()
{
int i,lower,upper,temp;
clrscr();
printf("Enter the range\n");
printf("\tLower Bound?");
scanf("%d",&lower);
printf("\tUpper Bound?");
scanf("%d",&upper);
if(lower>upper)
{  
temp=lower;
lower=upper;
upper=temp;
}

Wednesday, October 5, 2011

Love Calculator Using C++


#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
#include<string.h>
int q=0;
char name1[100],name2[100],n[100];
void load(int x)
{
textcolor(BLUE);
for(int i=0;i<x+1;i++)
{
clrscr();
cout<<"\n\n                        LOVE CALCULATOR\n";
cout<<"      ===============\n\n";
cout<<"      Your Name : "<<name1;
cout<<"\n\n     Lover Name : "<<name2;
cout<<"\n\n               Enter a number : "<<n;
cout<<"\n\n\n";
textcolor(RED);
cputs("                        LOVE PERCENTAGE : ");
textcolor(RED);
cout<<i<<"%";
textcolor(BLUE);
delay(20);
}

Friday, September 30, 2011

Program To search a number in a set of numbers using C


#include<stdio.h>
#include<conio.h>
void main()
{
int  i,n,count=0;
float num[50],search;
clrscr();
printf("how many numbers ?");
scanf("%d",&n);
if(n<=0)
printf("invalid data");
else
{
for(i=0;i<n;i++)
{
printf("Enter the number-%d:",i+1);
scanf("%f",&num[i]);
}
printf("\n\n\nNumber to searched ? ");
scanf("%f",&search);
clrscr();

To Display The Sum Of 1!+2!+3!+.......+n! using C


#include<stdio.h>
#include<conio.h>
double fact(int n);
void main()
{
int n,i;
double sum=0.0;
clrscr();
printf("Up To Which Term ?");
scanf("%d",&n);
for(i=1;i<=n;++i)
sum+=fact(i);
printf("Sum Of The Factorials Of The Numbers Up To %d Is %g",n,sum);
getch();
}
double fact(int n)
{

Factorial of a number using c


#include<stdio.h>
void main()
{
int i,n,fact=1;
clrscr();
printf("Enter the number : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
 {
  fact=fact*i;
 }
  printf("%d",fact);
getch();
}

Thursday, September 29, 2011

Students Result Calculation program using PL/SQL


Objective

An examination has been conducted to a class of 5 students and four scores of each student have been provided in the data along with  register number and name. Write a PL/SQL block to do the following
Assign a  letter grade to each student based on the average score;
Average Score     Grade
90-100                   a
75-89                      b
60-74                     c
50-59                     d
0-49                        e

Program

SQL> create table studres(regno number(4) primary key, name varchar(20), paper1 number(2), paper2 number(2), paper3 number(2), paper4 number(2));
Table created
SQL> insert into studres values(1001,’mini’, 23, 49, 44, 46);
1 row created
SQL> insert into studres values(1002,’safeer’, 40, 30, 20, 10);
1 row created
SQL> insert into studres values(1003,’baby’, 49, 39, 46, 45);
1 row created
 SQL> insert into studres values(1004,’danish’, 40, 10, 20, 22);
1 row created

News Paper Vendor program using PL/SQL


Objective

 Every morning a newspaper vendor newspapers in wholesale from a distributor for 60 paise. He sells them in retail for 75 paise. At the end of the day the unsold papers are returned to the distributor for 30 paise rebate per paper. Write a PL/SQL code block to prepare a report for the newspaper vendor in the following format with 5 weeks data.
Week     Bought      Sold        Return        Profit        Loss
       1                   60                  30         
      2                   75                  40
        .                     .                      .
program:

SQL>Create table vendor (week number(2) primary key, bought number(2), sold number(2));
Table created.
SQL>inser into vendor values(1,100,75);
1 row created.
SQL>insert into vendor values(2,70,60);
1 row created.
SQL>insert into vendor values(3,45,20);
1 row created.
SQL>insert into vendor values(4,60,55);
1 row created.
SQL>insert into vendor values(5,50,50);
1 row created.
SQL>ALTER TABLE vendor add(return number(10), profit number(6,2), loss number(6,2));
Table altered.
SQL> ed news;
        declare

Salary Report program using PL/SQL


Objective

A salary statement contains Name, Basic pay , allowance total , deduction
(include , IT ),  gross pay, and net pay .
Allowance      =    20% of basic pay
gross pay       =   Basic pay + Allowance.
Deduction      =  10% of basic pay
income tax is calculated on the basis of annual income under the following condition.

annual salary                                                      Income tax
  < =300,000                                                           Nil
  >30,000 but <55,000                                         30% of excess over the amount Rs = 30,000/-
 >=55,000                                                                50% of excess over the amount Rs = 55,000/-


program:

SQL > Create table salary (empno number (5) primary key , name varchar(20), basis pay
number (10,2));
Table Created.
SQL> Insert into . salary values (1001 , 'Baby' ,15,000);
1 row Created
SQL > Insert into salary values (1002, 'Hanna', 20,000);
1 row Created
SQL>insert into salary values (1003, 'chinnu',6000);
1 row Created
SQL > insert into salary values (1004, 'megha', 400,000);
1 row Created.
SQL > Insert into salary values (1005, 'swetha', 5200);
1 row Created.
SQL > ALTER TABLE salary add (allowance number (10,2) , deduction number (10,2),gross pay number (10,2), net pay number (10,2), income tax number (10,2));
Table Altered.
SQL > ed Sal;
declare
        v-allw  salary allowance%type ;
        v-gp  salary gross pay%type ;
        v-ded salary deduction%type ;
         v-net salary net pay%type ;
         v-inc salary income tax%type
 cursor c selected  *  from  salary ;
an in number (10,2);
begin

Sunday, September 25, 2011

Sales report using SQL


Objective
A sales report contains the  record with the following fields: itemid, itemname, salesprice, quantity and total price. Write a PL/SQL procedure to generate sales report.
Program
SQL>create table sales(itemid varchar(10), itemname varchar(20), salesprice number(6,2), quantity number(4));
Table created
SQL>insert into sales values(‘s001’,’pen’,10,10);
1 row created
SQL>insert into sales values(‘s002’,’pencil’,4,20);
1 row created
SQL>insert into sales values(‘s003’,’scale’,5,10);
1 row created
SQL>insert into sales values(‘s004’,’eraser’,6,20);
1 row created
SQL>insert into sales values(‘s005’,’notebook’,15,10);
1 row created
SQL> alter table sales add (tot_price number(6,2));
Table altered
SQL>declare

Library information System using SQL


Objective
Create a library information system
Program
SQL> create table library(book_id varchar(10) primary key, b_name varchar(20) notnull, author varchar(20) notnull);
Table created
SQL>insert into library values(‘b001’,’vb’,’abbas’);
1 row created
SQL>insert into library values(‘b002’,’cpp’,’kanethkar’);
1 row created
SQL>insert into library values(‘b003’,’SAD’,’Alias’);
1 row created
SQL>insert into library values(‘b004’,’java’,’kanethkar’);
1 row created
SQL> ed lib
Declare

Hotel bill system using SQL


Objective
Create a hostel bill calculating system
Program
SQL> create table hotel(cust_id varchar(6) primary key, cust_name varchar(20), item varchar(20), quantity number(6,2), price number(10,2));
Table created
SQL> insert into hotel values(‘H001’,’midhun’,’tea’,3,5);
1 row created
SQL> insert into hotel values(‘H002’,’praveen’,’broast’,2,100);
1 row created
SQL> insert into hotel values(‘H003’,’dileep’,’rice’,3,20);
1 row created
SQL> insert into hotel values(‘H004’,’shiju’,’coffee’,4,10);
1 row created
SQL> alter table hotel add (total number(10,2));
Table altered
SQL> declare
2 cursor hot is select * from hotel;
3 v_t hotel.total%type;
4 begin

Hostel Accounting system


Objective
Create a hostel accounting system
Program
SQL>create table hostel(stud_id varchar(10) primary key, stud_name varchar(20), rent number(6,2), mess number(6,2),ectr number(6,2), days number(2) check(days<31)and (days>0));
Table created
SQL>insert into hostel values(‘100’,’vishnu’,12,5,3,24);
1 row created
SQL>insert into hostel values(‘101’,’rabeeh’,12,5,3,20);
1 row created
SQL>insert into hostel values(‘102’,’tinu’,12,5,3,28);
1 row created
SQL>insert into hostel values(‘103’,’sarath’,12,5,3,14);
1 row created
SQL> alter table hostel add(tot_fee number(6,2));
Table altered
SQL>ed hostel
Declare

Saturday, September 24, 2011

Hospital Management System using PL/SQL


Hospital Information System having the following Information
Patient Number, Patient Name, Age, Doctor, Patient, type(in/out), Consultation charge, Blood test charge, Xray charge, other test
Write a PL/SQL procedure to retrieve the following
     1.  Patient undergo blood test
     2.  The patient taken x-ray
      3.  The patient who belong to patient’s category.



Program
SQL> create table patient(p_num number(10) primary key, p_name varchar(20),age number(3),dr varchar(20),p_type varchar(3) check(p_type=’in’ or p_type=’out’), cons_charge number(10,2), x_ray_charge number(10,2), b_t charge number(10,2), o_t_charge number(10,2));
Table Created
SQL> ed inspat
Insert into patient values(1,’anoop’,35,’anees’,’in’,250,125,360,130);
Insert into patient values(2,’najeeb’,35,’rajiya’,’out’,364,162,355,825);

Electricity billing system using PL/SQL


Objective
Create an electricity billing system, rent rs 20/-
Slab 1 : 1-40 units-0
Slab2: 40-80 units -40
Slab3: >80 -1.40+excess of 80

Program

SQL> create table electricity(cons_id varchar(4) primary key, c_name varchar(20), rent number(2) check (rent=20), unit number(6));
Table created
SQL> insert into electricity values (‘E001’,’deepika’,20,35);
1 row created
SQL> insert into electricity values (‘E002’,’varna’,20,61);
1 row created
SQL> insert into electricity values (‘E003’,’arun’,20,80);
1 row created
SQL> insert into electricity values (‘E004’,’rahul’,20,90);
1 row created

Program to accept an amount in rupees and display the number of currency notes


#include <stdio.h>
#include<conio.h>
 void main()
        {
            int amt,t,n1,n2,n3,n4,n5,n6,n7,n8,n9,total;
            printf("\n Enter the amount");
            scanf("%d",&amt);
            t=amt;
            n1=amt/1000;
           amt=amt%1000;
           n2=amt/500;
           amt=amt%500;
           n3=amt/100;
           amt=amt%100;
           n4=amt/50;
           amt=amt%50;
           n5=amt/20;
           amt=amt%20;
           n6=amt/10;
           amt=amt%10;
           n7=amt/5;
           amt=amt%5;
           n8=amt/2;
          n9=amt%2;

Sunday, August 7, 2011

Matrix addition


#include<stdio.h>
void main()
{
int a[10][10],b[10][10],c[10][10],i,j,row,col;
clrscr();
printf("How many rows : ");
scanf("%d",&row);
printf("How many columns : ");
scanf("%d",&col);
printf("Enter your 1st matrix :\n");
for(i=0;i<row;++i)
   for(j=0;j<col;j++)
      {
      printf("Element(%d,%d) :",i+1,j+1);
      scanf("%d",&a[i][j]);
      }

Armstrong numbers upto a given number

#include<stdio.h>
#include<math.h>
void main()
{
int num,sum,lim,dig,temp;
clrscr();
printf("Enter the limit :");
scanf("%d",&lim);
printf("\nArmstrong num upto %d are :\n",lim);
for(num=1;num<=lim;++num)
   {
   for(temp=num,sum=0;temp>0;temp/=10)

Largest and smallest among n numbers

#include<stdio.h>
void main()
{
int n,i=1,num,big,small;
clrscr();
printf("Among how many numbers : ");
scanf("%d",&n);
if(n<0)
  printf("invalid input");
else
  {
  printf("Enter number %d :",i);
  scanf("%d",&num);
  big=small=num;
  for(;i<n;++i)
     {
     printf("Enter number %d :",i+1);
     scanf("%d",&num);
     if(big<num)
       big=num;
     if(small>num)
       small=num;
     }

Matrix subtraction

#include<stdio.h>
void main()
{
int a[10][10],b[10][10],c[10][10],d[10][10],i,j,row,col;
clrscr();
printf("How many rows : ");
scanf("%d",&row);
printf("How many columns : ");
scanf("%d",&col);
printf("Enter your 1st matrix :\n");
for(i=0;i<row;++i)
   for(j=0;j<col;j++)
      {
      printf("Element(%d,%d) :",i+1,j+1);
      scanf("%d",&a[i][j]);
      }

To generate pattern 333 22 1

#include<stdio.h>

void main()
{
int i,j,n;
clrscr();
printf("how many lines you need to print :");
scanf("%d",&n);
for(i=n;i>0;i--)
   {
   for(j=0;j<i;j++)
      {
      printf("%d",i);
      }
    printf("\n");
   }
getch();
}

To display the 1st n prime numbers

#include<stdio.h>
#include<math.h>

void main()
{
int i,num,lim,flag,count=0;
clrscr();
printf("Enter the no.of prime numbers:");
scanf("%d",&lim);
printf("1st %d prime numbers are :\n",lim);
for(num=2;count<lim;++num)
   {
   flag=1;
   for(i=2;i<=sqrt(num);++i)

To generate pattern 1 12 123

#include<stdio.h>

void main()
{
int i,j,n;
clrscr();
printf("how many lines you need to print :");
scanf("%d",&n);
for(i=0;i<n;i++)
   {
   for(j=0;j<=i;j++)
      {
      printf("%d",j+1);
      }
    printf("\n");
   }
getch();
}

To generate pattern 321 21 1


#include<stdio.h>

To generate pattern * ** ***


#include<stdio.h>

To generate pattern*** ** *


#include<stdio.h>

To generate pattern 1 12 123


#include<stdio.h>

Number in reverse


#include<stdio.h>

Sum of individual digits of a number


#include<stdio.h>

Convert temperature in degree celcius to farenheit

#include<stdio.h>

Thursday, July 28, 2011

Sum of elements of a matrix

#include<stdio.h>
void main()

Display whole numbers upto a given number

#include<stdio.h>
void main()

{
int i,num=0,n;
clrscr();
printf("Enter the limit : upto ");
scanf("%d",&n);
for(i=0;i<n;i++)
 {
 num+=1;
 printf("%d\t",num);
 }
getch();
}

Display whole numbers between two given numbers

#include<stdio.h>
void main()

{
int i,j,num,k,initial;
clrscr();
printf("Enter the limit :  ");
scanf("%d%d",&j,&k);
if(j>k)
{
num=j-k;
initial=k;
}
else
{
num=k-j;
initial=j;

Whole numbers from 100 to 2

#include<stdio.h>
void main()

Volume of a box

#include<stdio.h>
void main()

Find the Area, Perimeter of a rectangle

#include<stdio.h>
void main()

Prime Number

#include<stdio.h>
void main()

Palindrome Number

#include<stdio.h>
void main()

Display odd numbers upto a given number and display their sum and average

#include<stdio.h>
void main()

Check whether the number is multiple of 5

#include<stdio.h>
void main()