P. 1
6944617-Let-Us-C

6944617-Let-Us-C

|Views: 24|Likes:
Published by mahalaxmi143

More info:

Published by: mahalaxmi143 on Nov 19, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

12/24/2010

pdf

text

original

WAP which will input only 2 nos.

Also input your choice : If choice = 1 then display sum of 2
nos, If choice=2 display substract, If choice=3 display ultiplication, If choice=! "i#ision, if
choice=$ "isplay Power of 2 nos %
&include 'stdio.h(
&include 'math.h(
main)*
+
float a,b,c,
int op,
clrscr)*,
printf)-.nter 2 nos-*,
scanf)-/f /f-,0a,0b*,
printf)-.nter your option: 1=sum: 2=sub: 3=mul: !="i#: $=pow-*,
scanf)-/d-,0op*,
switch)op*
+
case 1:
c=a1b,brea2,
case 2:
c=a3b,brea2,
case 3:
c=a4b,brea2,
case !:
c=a5b,brea2,
case $:
c=pow)a,b*,brea2,
default:
printf)-6our choice is wron7-*,
e8it)*,
9
printf)-:esult is /.2f-,c*,
7etch)*,
9
2. WAP to find a number is odd or e#en, prime or not, armstron7 or not, factorial %
&include'stdio.h( 55 use for printf, scanf function
&include'conio.h( 55 use for 7etch,clrscr function
&include'stdlib.h( 55 use for e8it function
&include'math.h( 55 use for pow function
#oid main)*
+
int i,a,ch,f,t2,
do
+
clrscr)*,
printf)-;n;n;t;t;t ain enu-*,
printf)-;n;nPress 1 to <actorial of a number-*,
printf)-;nPress 2 to chec2 a number is prime or not-*,
printf)-;nPress 3 to chec2 a number is odd or e#en-*,
printf)-;nPress ! to chec2 of a number is armstron7 or not-*,
printf)-;nPress any other number to e8it...-*,
printf)-;n;n.nter you choice : -*,
scanf)-/d-,0ch*,
if)ch(= 00 ch'$*
+
printf)-;n;n.nter a number = -*,
scanf)-/d-,0a*,
9
switch)ch*
+
case 1:
printf)-;n;n <actorial of /d are ;n-,a*,
for)i=1,i'=a,i11*
+
if ) a/i===*
printf)- /d -,i*,
9
brea2 ,
case 2:
f==,
printf)-;n;n Prime chec2in7...... ;n-*,
for)i=2,i'pow)a,.$*11,i11*
+
if ))a/i*===*
f=1,
9
if )f==1*
printf)-;n/d is not prime number... -,a*,
else
printf)-;n/d is prime number... -,a*,
brea2,
case 3:
printf)-;n;n >dd or .#en chec2in7...... ;n-*,
if ))a/2*===*
printf)-;n/d is e#en number... -,a*,
else
printf)-;n/d is odd number... -,a*,
brea2,
case !:
f==,
t2==,
printf)-;n;n Armstron7 chec2in7...... ;n-*,
i=a,
while)i?==*
+
t2=t21pow))i/1=*,3*,
i=i51=,
9
if )a==t2*
printf)-;n/d is Armstron7 number... -,a*,
else
printf)-;n/d is not Armstron7 number... -,a*,
brea2,
default:
e8it)=*,
9,
printf)-;n;n;n;nPress any 2ey to contiune........-*,
7etch)*,
9while)ch(= 00 ch'$*,
9
Loop
1. @alculate 0 "isplay Aum 1 ultiplication of ultiple Bos )112131!1$....* %
&include 'stdio.h(
&include 'math.h(
main)*
+
int i,n,s==,m=1,
clrscr)*,
printf)-.nter no of terms : -*,
scanf)-/d-,0n*,
printf)-Che series are :-*,
for)i=1,i'=n,i11*
printf)-/!d-,i*,
for)i=1,i'=n,i11*
+
s=s1i,
m=m4i,
9
printf)-;nAum is /d-,s*,
printf)-;nul is /d-,m*,
7etch)*,
9
2. @alculate 0 "isplay Aum 1 ultiplication of >dd Bos %
&include 'stdio.h(
&include 'math.h(
main)*
+
int i,n,s==,m=1,
clrscr)*,
printf)-.nter no of terms : -*,
scanf)-/d-,0n*,
printf)-Che series are :-*,
for)i=1,i'=n,i11*
printf)-/!d-,24i31*,
for)i=1,i'=n,i11*
+
s=s1)24i31*,
m=m4)24i31*,
9
printf)-;nAum is /d-,s*,
printf)-;nul is /d-,m*,
7etch)*,
9
3. Ducas Aeries
&include 'stdio.h(
main)*
+
int a==,b=1,c=1,i,n,t,
clrscr)*,
printf)-.nter no of terms : -*,
scanf)-/d-,0n*,
printf)-Che Ducas series is : /!d /!d /!d-,a,b,c*,
for)i=!,i'=n,i11*
+
t=a1b1c,
printf)-/!d-,t*,
a=b,
b=c,
c=t,
9
7etch)*,
9
!. "isplay B nos in the followin7 format %
&include 'stdio.h(
main)*
+
int i,n,E,
clrscr)*,
printf)-.nter no of terms : -*,
scanf)-/d-,0n*,
for)i=1,i'=n,i11*
+
for)E=i,E'n,E11*,
printf)- -*,
for)E=1,E'24i31,E11*
printf)F/dG,i*,
printf)F;nG*,
9
7etch)*,
9
$. "isplay B nos in the followin7 format %
&include 'stdio.h(
main)*
+
int i,n,E,
clrscr)*,
printf)-.nter no of terms : -*,
scanf)-/d-,0n*,
for)i=1,i'=n,i11*
+
for)E=i,E'n,E11*
printf)- -*,
for)E=1,E'=24i31,E11*
printf)- /c-,H!1E*,
printf)-;n-*,
9
7etch)*,
9
Array
1. "isplay Aum 0 A#era7e of B nos %
&include 'stdio.h(
main)*
+
1
1 2
1 2 3
1 2 3 !
A
A I @
A I @ " .
int aJ1==K,i,n,s==,
float a#,
clrscr)*,
printf)-.nter no of terms : -*,
scanf)-/d-,0n*,
printf)-.nter elements-*,
for)i==,i'n,i11*
scanf)-/d-,0aJiK*,
for)i==,i'n,i11*
+
s=s1aJiK,
a#=)float*s5n,
9
printf)-;n Aum is /d-,s*,
printf)-;n A#era7e is /.2f-,a#*,
7etch)*,
9
2. "isplay a8 of B nos %
&include 'stdio.h(
main)*
+
int aJ1==K,i,n,m,
clrscr)*,
printf)-.nter no of terms : -*,
scanf)-/d-,0n*,
printf)-.nter elements-*,
for)i==,i'n,i11*
scanf)-/d-,0aJiK*,
m=aJ=K,
for)i==,i'n,i11*
if)aJiK(m*
m=aJiK,
printf)-;n a8 no is /d-,m*,
7etch)*,
9
3. 2$ nos are entered throu7h 2eyboard. @ount how many nos are Positi#e and Be7ati#e %
&include 'stdio.h(
main)*
+
int aJ2$K,i,pos==,ne7==,
clrscr)*,
printf)-.nter elements-*,
for)i==,i'=2!,i11*
scanf)-/d-,0aJiK*,
for)i==,i'=2!,i11*
if)aJiK(==*
pos11,
else
ne711,
printf)-;n Positi#e no is /d-,pos*,
printf)-;n Be7ati#e no is /d-,ne7*,
7etch)*,
9
!. "isplay array in ascendin7 order %
&include 'stdio.h(
main)*
+
int aJ1==K,i,n,E,t,
clrscr)*,
printf)-.nter no of terms-*,
scanf)-/d-,0n*,
printf)-.nter elements-*,
for)i==,i'n,i11*
scanf)-/d-,0aJiK*,
for)i==,i'n31,i11*
for)E=i11,E'n,E11*
if)aJiK(aJEK*
+
t=aJiK,
aJiK=aJEK,
aJEK=t,
9
printf)-;n Che Ascendin7 >rder is :-*,
for)i==,i'n,i11*
printf)-/!d-,aJiK*,
7etch)*,
9
$. Input any no. "isplay re#erse 1 summation of that no %
&include 'stdio.h(
main)*
+
lon7 int a,s==,
clrscr)*,
printf)-.nter no :-*,
scanf)-/ld-,0a*,
printf)-Che :e#erse Bo is :-*,
while)a?==*
+
s=s1)a/1=*,
printf)-/ld-,a/1=*,
a=a51=,
9
printf)-;nAum is /ld-,s*,
7etch)*,
9
H. WAP which will input many nos. Aearch by any no 0 count how many times that no. appear%
&include 'stdio.h(
main)*
+
int aJ1==K,i,n,m,t==,
clrscr)*,
printf)-.nter no of terms:-*,
scanf)-/d-,0n*,
printf)-.nter elements-*,
for)i==,i'n,i11*
scanf)-/d-,0aJiK*,
printf)-.nter no to search-*,
scanf)-/d-,0m*,
for)i==,i'n,i11*
if)aJiK==m*
t11,
printf)-Bo of times =/d-,t*,
7etch)*,
9
L. @haracter :e#erse
&include 'stdio.h(
main)*
+
char aJ1==K,bJ1==K,
int i,l,E==,
clrscr)*,
printf)-.nter strin7:-*,
7ets)a*,
l=strlen)a*,
for)i=l31,i(==,i33*
+
bJEK=aJiK,
E11,
9
bJEK=M;=M,
printf)-:e#erse Atrin7 is : -*,
puts)b*,
printf)-Den7th is : /d-,l*,
7etch)*,
9
N. @haracter Ascendin7 %
&include 'stdio.h(
&include 'strin7.h(
main)*
+
char aJ1==KJ2=K,tJ2=K,
int i,E,n,
clrscr)*,
printf)-.nter how many name-*,
scanf)-/d-,0n*,
printf)-.nter name one by one :-*,
for)i==,i'=n,i11*
7ets)aJiK*,
for)i==,i'n31,i11*
for)E=i11,E'n,E11*
if)strcmpi)aJiK,aJEK*(=*
+
strcpy)t,aJiK*,
strcpy)aJiK,aJEK*,
strcpy)aJEK,t*,
9
printf)-Bame in ascendin7 order-*,
for)i==,i'=n,i11*
puts)aJiK*,
printf)-;n-*,
7etch)*,
9
String
1. WAP which will input a strin7 calculate Bo. of #owel, Bo. of Ilan2 Apaces, Bo of alphabets,
Bo. of "i7it, Bo. of Apecial @haracter of that strin7 %
&include 'stdio.h(
main)*
+
int i,l==,#==,d==,b==,
char aJ1==K,
clrscr)*,
printf)-.nter character: -*,
7ets)a*,
for)i==,aJiK?=M;=M,i11*
+
if)toupper)aJiK*==MAM OO toupper)aJiK*==M.M OO toupper)aJiK*==MIM OO toupper)aJiK*==M>M OO toupper)aJiK*==MPM*
#11,
if)toupper)aJiK*(=MAM 00 toupper)aJiK*'=MQM*
l11,
if)aJiK(=M=M 00 aJiK'=MRM*
d11,
if)aJiK==M M 00 aJi11K?=M M*
b11,
9
printf)-#owel is: /d-,#*,
printf)-;nBo of alphabet /d-,l*,
printf)-;n Bo of di7it /d-,d*,
printf)-;n Bo of Ilan2 Apaces /d-,b*,
printf)-;nApecial @haracter=/d-,i3d3l3b*,
7etch)*,
9
2. WAP which will input amal 2umar halder . "isplay li2e A.S.TAD".: %
&include 'stdio.h(
&include 'strin7.h(
main)*
+
char aJ1==K,
int i,l,8,y,
clrscr)*,
printf)-.nter Atrin7:-*,
7ets)a*,
l=strlen)a*,
for)i=1,i'l,i11*
if)aJiK==M M*
+
8=i,
brea2,
9
for)i=81i,i'l,i11*
if)aJiK==M M*
+
y=i,
brea2,
9
printf)-short form is : /c.-,toupper)aJ=K**,
printf)-/c.-,toupper)aJ811K**,
for)i=y11,i'l,i11*
printf)-/c-,toupper)aJiK**,
7etch)*,
9
3. Palindram %
&include 'stdio.h(
&include 'strin7.h(
main)*
+
char aJ1==K,bJ1==K,
int i,l,E==,
clrscr)*,
printf)-.nter Atrin7:-*,
7ets)a*,
l=strlen)a*,
for)i=l31,i(==,i33*
+
bJEK=aJiK,
E11,
9
bJEK=M;=M,
if)strcmpi)a,b*===*
printf)-Atrin7 is Palindram-*,
else
printf)-Bot Palindram-*,
7etch)*,
9
3. WAP which will chan7e the case of a character )Ppper to lower or #ice #ersa* %
&include 'stdio.h(
&include 'strin7.h(
main)*
+
char aJN=K,
int i,
clrscr)*,
printf)-.nter @haracter: -*,
7ets)a*,
for)i==,aJiK?=M;=M,i11*
if)aJiK(=MAM 00 aJiK'=MQM*
printf)-/c-,aJiK132*, )<or Dower @ase*
else if)aJiK(=MaM 00 aJiK'=MUM*
printf)-/c-,aJiK332*, )<or Ppper @ase*
7etch)*,
9
Function
1. WAP which will input any no. <ind the freVuency of any particular no %
&include 'stdio.h(
main)*
+
int aJN=K,i,n,m,c==,
clrscr)*,
printf)-.nter no of terms: -*,
scanf)-/d-,0n*,
printf)-.nter elements-*,
for)i==,i'n,i11*
scanf)-/d-,0aJiK*,
printf)-Bo to search-*,
scanf)-/d-,0m*,
c=not)a,m,n*,
printf)-Bo of times is /d-,c*,
7etch)*,
9
not)int aJK,int m,int n*
+
int i,c,
for)i==,i'n,i11*
if)aJiK==m*
c11,
return)c*,
9
2. WAP to find the <actorial of a no %
&include 'stdio.h(
main)*
+
int n,f,
clrscr)*,
printf)-.nter no: -*,
scanf)-/d-,0n*,
f=fact)n*,
printf)-<actorial is /d-,f*,
7etch)*,
9
fact)int n*
+
if)n==1*
return)1*,
else
return)n4fact)n31**,
9
3. Aum of .#en Bos %
&include 'stdio.h(
main)*
+
int n,s,
clrscr)*,
printf)-.nter no: -*,
scanf)-/d-,0n*,
s=sum)n*,
printf)-sum is /d-,s*,
7etch)*,
9
sum)int n*
+
if)n==1*
return)1*,
else
return))24n31*1sum)n31**,
9
!. W@" of 2 Bos %
&include 'stdio.h(
main)*
+
int a,b,p,7,
clrscr)*,
printf)-.nter 2 nos: -*,
scanf)-/d /d-,0a,0b*,
if)a'b*
p=a,
else
p=b,
7=7cd)a,b,p*,
printf)-Wcd is /d-,7*,
7etch)*,
9
7cd)int a,int b,int p*
+
if)a/p=== 00 b/p===*
return)p*,
else
return)7cd)a,b,33p**,
9
$. :e#erse Bo %
&include 'stdio.h(
main)*
+
lon7 int a,
clrscr)*,
printf)-.nter the no: -*,
scanf)-/ld-,0a*,
re#)a*,
7etch)*,
9
re#)lon7 int a*
+
if)a===*
return,
else
printf)-/ld-,a/1=*,
return)re#)a51=**,
9
H. .nter radius of a sphere. @alculate area 0 perimeter %
&include 'stdio.h(
&include 'math.h(
main)*
+
int r,
float a,p,
clrscr)*,
printf)-.nter radius: -*,
scanf)-/d-,0r*,
a=area)r*,
p=peri)r*,
printf)-Area is /.2f-,a*,
printf)-Perimeter is /.2f-,p*,
7etch)*,
9
area)int r*
+
float a,
a=225L.=4r4r,
return)a*,
9
peri)int r*
+
float p,
p=24225L.=4r,
return)p*,
9
L. <ibonacci Aeries %
&include 'stdio.h(
main)*
+
int a=1,b==,i==,
printf)-<ibonacci Aeries is :-*,
fibo)a,b,i*,
7etch)*,
9
fibo)int a,int b,int i*
+
if)i==2$*
return,
else
+
printf)-/!d-,a1b*,
return)fibo)b,a1b,11i**,
9
9
N. @haracter :e#erse %
&include 'Atdio.h(
main)*
+
char aJ3=K,
int l,
clrscr)*,
printf)-.nter strin7: -*,
7ets)a*,
l=strlen)a*,
printf)-:e#erse Atrin7 is :-*,
re#)a,l*,
7etch)*,
9
re#)char aJK,int l*
+
if)l===*
return,
else
+
printf)-/c-,aJl31K*,
return)re#)a,33l**,
9
9
R. Input :atan Aaha . "isplay Aaha :atan
&include 'stdio.h(
main)*
+
char aJ3=K,
clrscr)*,
printf)-.nter strin7: -*,
7ets)a*,
name)a*,
7etch)*,
9
name)char aJK*
+
int i,b,
for)i==,aJiK?=M;=M,i11*
if)aJiK==M M*
b=i,
printf)-Che Bame is : -*,
for)i=b11,aJiK?=M;=M,i11*
printf)-/c-,aJiK*,
printf)- -*,
for)i==,i'b,i11*
printf)-/c-,aJiK*,
return,
9
Pointer
1. "isplay no. in ascendin7 order %
&include 'stdio.h(
&include 'alloc.h(
main)*
+
int 4a,n,i,
clrscr)*,
printf)-.nter no of terms:-*,
scanf)-/d-,0n*,
a=)int 4*)malloc)siUeof)int*4n**,
printf)-.nter .lement: -*,
for)i==,i'n,i11*
scanf)-/d-,a1i*,
asc)a,n*,
printf)-Ascendin7 >rder is : -*,
for)i==,i'n,i11*
printf)-/!d-,4)a1i**,
7etch)*,
9
asc)int 4a,int n*
+
int i,t,E,
for)i==,i'n31,i11*
for)E=i11,E'n,E11*
if)4)a1i*'4)a1E**
+
t=4)a1i*,
4)a1i*=4)a1E*,
4)a1E*=t,
9
return,
9
2. "isplay a8 Bo %
&include 'stdio.h(
&include 'alloc.h(
main)*
+
int 4a,i,n,m,
clrscr)*,
printf)-.nter no of terms: -*,
scanf)-/d-,0n*,
a=))int4*malloc)siUeof)int*4n**,
printf)-.nter elements-*,
for)i==,i'n,i11*
scanf)-/d-,a1i*,
ma8)a,0m,n*,
printf)-Che a8 Bo is /d-,m*,
7etch)*,
9
ma8)int 4a, int 4m, int n*
+
int i,
4m=4)a1=*,
for)i==,i'n31,i11*
if)4)a1i*(4m*
4m=4)a1i*,
return,
9
3. WAP which will input 2 strin7 % "isplay it in the 3
rd
Atrin7 )@oncatenate* %
&include 'stdio.h(
&include 'alloc.h(
main)*
+
char 4s1,4s2,4s3,
clrscr)*,
s1=malloc)2=*,
s2=malloc)2=*,
s3=malloc)!=*,
printf)-.nter 1st Atrin7: -*,
7ets)s1*,
printf)-.nter 2nd Atrin7: -*,
7ets)s2*,
Eoin)s1,s2,s3*,
printf)-;n1st Atrin7 is /s-,s1*,
printf)-;n2nd Atrin7 is /s-,s2*,
printf)-;n3rd Atrin7 is /s-,s3*,
7etch)*,
9
Eoin)char 4s1, char 4s2, char 4s3*
+
while)4s1?=M;=M*
+
4s3=4s1,
s111,
s311,
9
while)4s2?=M;=M*
+
4s3=4s2,
s211,
s311,
9
4s3=M;=M,
return,
9
!. Input 2 strin7. @ompare both of them.
)1st strin7(2nd strin7*3 :esult 1
)1st strin7'2nd strin7*3 :esult X1
)1st strin7=2nd strin7*3 :esult =
&include 'stdio.h(
&include 'alloc.h(
main)*
+
char 4s1,4s2,
int l,
s1=malloc)2=*,
s2=malloc)2=*,
printf)-.nter 1st-*,
7ets)s1*,
printf)-.nter 2nd-*,
7ets)s2*,
l=re#)s1,s2*,
printf)-:esult is /d-,l*,
7etch)*,
9
re#)char 4s1,char 4s2*
+
int l1==,l2==,l,
for)l1==,4)s11l1*?=M;=M,l111*
for)l2==,4)s21l2*?=M;=M,l211*
+
if)l1(l2*
l=1,
else if)l1'l2*
l=31,
else
l==,
9
return)l*,
9
H. Input a strin7. @reate another strin7 which contain re#erse of 1st strin7 %
&include 'stdio.h(
&include 'strin7.h(
&include 'alloc.h(
main)*
+
char s1J2=K,4s2,
s2=malloc)2=*,
printf)-.nter strin7-*,
7ets)s1*,
re#)s1,s2*,
printf)->ri7inal strin7 /s-,s1*,
printf)-;n:e#erse strin7 /s-,s2*,
7etch)*,
9
re#)char 4s1,char 4s2*
+
int i,l,
l=strlen)s1*,
for)i=l31,i(==,i33*
+
4s2=4)s11i*,
4s211,
9
4s2=M;=M,
9
Alltrim
&include 'stdio.h(
&include 'alloc.h(
main)*
+
char 4s1,
clrscr)*,
s1=malloc)2=*,
printf)-enter a strin7:-*,
7ets)s1*,
printf)-ori7inal is Y/sY-,s1*,
printf)-;nalltril is Y/sY-,allt)s1**,
7etch)*,
9
allt)char 4s1*
+
int l,i,
while)4s1==M M*
s111,
l=strlen)s1*,
for)i=l31,i(==,i33*
if)4)s11i*?=M M*
brea2,
4)s11i11*=M;=M,
return)s1*,
9
Structure
&include 'stdio.h(
struct atanu
+
int r,
char nmJ3=K,
char crJ1=K,
int sJ3K,
int t,
9new,
main)*
+
int i,n,
clrscr)*,
printf)-.nter :oll:-*,
scanf)-/d-,0new.r*,
fflush)stdin*,
printf)-.nter Bame:-*,
7ets)new.nm*,
printf)-.nter @ourse:-*,
7ets)new.cr*,
printf)-.nter ar2s:-*,
new.t==,
for)i==,i'3,i11*
+
scanf)-/d-,0new.sJiK*,
new.t=new.t1new.sJiK,
9
printf)-:oll is:/d-,new.r*,
printf)-;nBame is:-*,
puts)new.nm*,
printf)-;n@ourse is:-*,
puts)new.cr*,
printf)-;nAubEects are:-*,
for)i==,i'3,i11*
printf)-/!d-,new.sJiK*,
printf)-;nCotal is /!d-,new.t*,
7etch)*,
9
2. &include 'stdio.h(
struct atanu
+
int r,
char nmJ2=K,
char crJ2=K,
int sJ!K,
int t,
char 7,
9newJ3=K,
main)*
+
int i,E,n,
printf)-.nter no of record:-*,
scanf)-/d-,0n*,
for)i==,i'n,i11*
+
fflush)stdin*,
printf)-.nter :oll:-*,
scanf)-/d-,0newJiK.r*,
fflush)stdin*,
printf)-.nter Bame:-*,
7ets)newJiK.nm*,
fflush)stdin*,
printf)-.nter @ourse:-*,
7ets)newJiK.cr*,
newJiK.t==,
for)E==,E'3,E11*
+
scanf)-/d-,0newJiK.sJEK*,
newJiK.t=newJiK.t1newJiK.sJEK,
9
if)newJiK.t(2!=*
newJiK.7=MAM,
else if)newJiK.t'2!=00newJEK.t(2==*
newJiK.7=MIM,
else
newJiK.7=M<M,
9
printf)-:oll;t Bame;t @ourse;t Aub1;t Aub2;t Aub3;t Cotal;t Wrade;n-*,
for)i==,i'n,i11*
+
printf)-/!d-,newJiK.r*,
printf)-;t/s-,newJiK.nm*,
printf)-;t/s-,newJiK.cr*,
for)E==,E'3,E11*
printf)-;t/!d-,newJiK.sJEK*,
printf)-;t/!d-,newJiK.t*,
printf)-;t/c-,newJiK.7*,
printf)-;n-*,
9
7etch)*,
9
FILE- WAP which will input data 0 data will be stored in atanu.t8t
&include 'stdio.h(
typedef struct atanu
+
char cdJHK,
char nmJ2=K,
float bal,
9atanu,
main)*
+
atanu new,
<ID. 4f,
int n,i,
clrscr)*,
f=fopen)-atanu.t8t-,-w-*,
printf)-enter no of records-*,
scanf)-/d-,0n*,
for)i==,i'n,i11*
+
fflush)stdin*,
printf)-.nter A5@ @ode:-*,
7ets)new.cd*,
fflush)stdin*,
printf)-.nter Bame:-*,
7ets)new.nm*,
printf)-.nter Ialance:-*,
scanf)-/f-,0new.bal*,
fprintf)f,-;n /s /s /f-,new.cd,new.nm,new.bal*,
9
fclose)f*,
9
Link List
&include 'stdio.h(
&include 'alloc.h(
typedef struct atanu
+
int data,
struct atanu 4lin2,
9node,
node 4head,
main)*
+
int op==,
while)op?=$*
+
printf)-;n1.@reate 2.Insert 3."elete !."isplay $. .8it-*,
scanf)-/d-,0op*,
switch)op*
+
case 1:
create)*,
brea2,
case 2:
insert)*,
brea2,
case 3:
delete)*,
brea2,
case !:
display)*,
9
9
9
create)*
+
int 8,
node 4p,
printf)-.nter any #alue)= to stop*-*,
scanf)-/d-,08*,
p=)node 4* malloc)siUeof)node**,
head=p,
while)8?==*
+
p3(data=8,
printf)-.nter any Zalue-*,
scanf)-/d-,08*,
if)8===*
brea2,
p3(lin2=)node4* malloc)siUeof)node**,
p=p3(lin2,
9
p3(lin2=BPDD,
return,
9
insert)*
+
node 4p,4new,
int 8,y,
printf)-.nter any #alue-*,
scanf)-/d-,08*,
printf)-.nter element after insert-*,
scanf)-/d-,0y*,
p=head,
while)p3(data?=y 00 p3(lin2?=BPDD*
p=p3(lin2,
new=)node 4* malloc)siUeof)node**,
if)p3(data==y*
+
new3(data=8,
new3(lin2=p3(lin2,
p3(lin2=new,
9
return,
9
delete)*
+
int 8,
node 4p,4V,
printf)-.nter element to be deleted-*,
scanf)-/d-,08*,
if)head3(data==8*
+
head=head3(lin2,
return,
9
p=head,
while)p3(data?=8 00 p3(lin2?=BPDD*
+
V=p,
p=p3(lin2,
9
if)p3(data==8*
+
V3(lin2=p3(lin2,
free)p*,
9
else
printf)-"ata is not found-*,
return,
9
display)*
+
node 4p,
p=head,
printf)-Che .lements are-*,
while)p?=BPDD*
+
printf)-/!d-,p3(data*,
p=p3(lin2,
9
return,
9

printf("\n\nEnter a number = "); scanf("%d",&a); } switch(ch) { case 1: printf("\n\n Factorial of %d are \n",a); for(i=1;i<=a;i++) { if ( a%i==0) printf(" %d ",i); } break ; case 2: f=0; printf("\n\n Prime checking...... \n"); for(i=2;i<pow(a,.5)+1;i++) { if ((a%i)==0) f=1; } if (f==1) printf("\n%d is not prime number... ",a); else printf("\n%d is prime number... ",a); break; case 3: printf("\n\n Odd or Even checking...... \n"); if ((a%2)==0) printf("\n%d is even number... ",a); else printf("\n%d is odd number... ",a); break; case 4: f=0; t2=0; printf("\n\n Armstrong checking...... \n"); i=a; while(i!=0) { t2=t2+pow((i%10),3); i=i/10; } if (a==t2) printf("\n%d is Armstrong number... ",a); else printf("\n%d is not Armstrong number... ",a); break; default: exit(0); }; printf("\n\n\n\nPress any key to contiune........"); getch(); }while(ch>0 && ch<5); }

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->