search engine and directory
free counters
Copyright © 2010. EDataFinder. All rights reserved.
 

C LAB CODINGS
C Program for BANK OPERATION.

#include<stdio.h>
#include<conio.h>
void creation();
void deposit();
void withdraw();
void bal();
int a=0,i = 101;
struct bank
{
int no;
char name[20];
float bal;
float dep;
}s[20];
void main()
{
int ch;
while(1)
{
clrscr();
printf("n*********************");
printf("n BANKING ");
printf("n*********************");
printf("n1-Creation");
printf("n2-Deposit");
printf("n3-Withdraw");
printf("n4-Balance Enquiry");
printf("n5-Exit");
printf("nEnter your choice");
scanf("%d",&ch);
switch(ch)
{
case 1: creation();
break;
case 2: deposit();
break;
case 3: withdraw();
break;
case 4: bal();
break;
case 5: exit(0);
defalut: printf("Enter 1-5 only");
getch();
}
}
}
void creation()
{
printf("n*************************************");
printf("n ACCOUNT CREATION ");
printf("n*************************************");
printf("nYour Account Number is :%d",i);
s[a].no = i;
printf("nEnter your Name:");
scanf("%s",s[a].name);
printf("nYour Deposit is Minimum Rs.500");
s[a].dep=500;
a++;
i++;
getch();
}
void deposit()
{
int no,b=0,m=0;
float aa;
printf("n*************************************");
printf("n DEPOSIT ");
printf("n*************************************");
printf("nEnter your Account Number");
scanf("%d",&no);
for(b=0;b<i;b++)
{
if(s[b].no == no)
m = b;
}
if(s[m].no == no)
{
printf("n Account Number : %d",s[m].no);
printf("n Name : %s",s[m].name);
printf("n Deposit : %f",s[m].dep);
printf("n How Much Deposited Now:");
scanf("%f",&aa);
s[m].dep+=aa;
printf("nDeposit Amount is :%f",s[m].dep);
getch();
}
else
{
printf("nACCOUNT NUMBER IS INVALID");
getch();
}
}
void withdraw()
{
int no,b=0,m=0;
float aa;
printf("n*************************************");
printf("n WITHDRAW ");
printf("n*************************************");
printf("nEnter your Account Number");
scanf("%d",&no);
for(b=0;b<i;b++)
{
if(s[b].no == no)
m = b;
}
if(s[m].no == no)
{
printf("n Account Number : %d",s[m].no);
printf("n Name : %s",s[m].name);
printf("n Deposit : %f",s[m].dep);
printf("n How Much Withdraw Now:");
scanf("%f",&aa);
if(s[m].dep<aa+500)
{
printf("nCANNOT WITHDRAW YOUR ACCOUNT HAS MINIMUM BALANCE");
getch();
}
else
{
s[m].dep-=aa;
printf("nThe Balance Amount is:%f",s[m].dep);
}
}
else
{
printf("INVALID");
getch();
}
getch();
}
void bal()
{ int no,b=0,m=0;
float aa;
printf("n*************************************");
printf("n BALANCE ENQUIRY ");
printf("n*************************************");
printf("nEnter your Account Number");
scanf("%d",&no);
for(b=0;b<i;b++)
{
if(s[b].no == no)
m = b;
}
if(s[m].no==no)
{
printf("n Account Number : %d",s[m].no);
printf("n Name : %s",s[m].name);
printf("n Deposit : %f",s[m].dep);
getch();
}
else
{
printf("INVALID");
getch();
}
}

C Program for finding COS THETA Value
 
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define ACC 0.0001
#define PI 3.14
void main()
{
int x,i;
float x1,x2,cosz=0,term;
clrscr();
printf("Enter the X value:");
scanf("%d",&x);
x1=(x*PI)/180;
// printf("%f",cos(x1));
x2=x1*x1;
term=1;
cosz=term;
for(i=2;fabs(term)>ACC;i=i+2)
{
term = (x2*(-term))/(i*(i-1));
cosz = cosz+term;
}
printf("nNew Value%f",cosz);
getch();
}
C Program for Exponential value.
#include<stdio.h>
#include<conio.h>
void main()
{
double term=1,expo=1;
float x;
int i;
clrscr();
printf("Enter the exp value of x: ");
scanf("%f",&x);
for(i=1;term>=0.00001;i++)
{
term *= x/i;
expo+=term;
}
printf("Our Exp = %f %fn",x,expo);
getch();
}

C Program for factorial using recursion.

 
#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
int a,b=0,c;
clrscr();
printf("Enter the N value:");
scanf("%d",&a);
while(a<0)
{printf("nEnter only positive number.n");
printf("Enter N value:");
scanf("%d",&a);
}
b=fact(a);
printf("%d",b);
getch();
}
int fact(int x)
{
if(x==0)
{
return(1);
}
else
{
return((x)*(fact(x-1)));
}
}

C Program for fibanacci series using recursion

#include<stdio.h>
#include<conio.h>
int fib(int);
void main()
{
int a,b,i,c;
clrscr();
printf("Enter the N value");
scanf("%d",&a);
for(i=0;i<a;i++)
{
printf("n%d",fib(i));
}
getch();
}
int fib(int x)
{
if(x==0)
return(0);
if(x<=1)
{
return(1);
}
else
{
return(fib(x-1)+(fib(x-2)));
}
}


C Program for String Length.

 
 

































IP address





Google: Yahoo: MSN:







Today, there have been 3 visitors (77 hits) on this page!
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free