0% found this document useful (0 votes)
3K views23 pages

PPS Practical File 1

The remaining programs check if two numbers are equal (Program 5), find the greatest among

Uploaded by

Om Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views23 pages

PPS Practical File 1

The remaining programs check if two numbers are equal (Program 5), find the greatest among

Uploaded by

Om Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Expeviment-

Afm Aukjects
Lute a pMOqam that accept ho mawks ot5
ab taintd by
ard firds th um anod peucuntag1 mauks
th atudent
BuogAam Code g-
# include <Stdio h
# include konio.h>
void mainC)

csCY ) ;
int 0,b,C,d,e, Sum, peurent@g4
Puintf(" Mauk obtained in English);
Scanf hd' 2a);
Puunt (" Nauk obtaiheol in Mah
Scan( d", &b);
Punt? Mauk obtaihed n chemisty
Scwnf " 4d", &c);
obtained in Physica J
fuintf(" Mauk
Scanf (" hd", &d)
Buntf ( Nauk obtained in ompute ,
Scanf (" /»d", &e);
Sum atbtC +dte;
(Sum /5oo) * loo,
Pexcentage
Puintf (Tatok mayks obtaineol = d', Sum;
Puntf "Rcentag e = %d peucentas9);
getch C
Output Bucgstam
obaind ún
Mauk
English 80
Mawk Obtainnod in Math 90
MOuk obtalnod in chumistry 100

obtained in 00
Mawk physica
Mauk obtainod in Computer 100

"Tata Mauks obtaineo= 470


Peucentege = 94
xperiment -2
Afm
uute C poguam that calculates th Simple inteuBt

nd
nol Compoud hfestTho psunipal amaurt, Rate f
inttest an+ime au entaud thsuoygt tho keyboa

seuam Gde
indude stdio.h>
includu Conio.h
includl K math h
Void main ()

clsc (); tht Q, , t , P,Si1


Puintf C" Amaunt = J
Sconf C t d", &a):
Puintf Rate o inderwt=
Scanf ("oh d ",br);
Puintf ('Timt ");
Sconf ( d", at);
Psuntf (" Buunegal
amaund =
"J;
Scanf ( / d"', á P);
ST P*Tt
float CT= (p Pow(C1 3),+)P
'
in tevest o, "sI);
Patintf( Simple f",cT):
Puihtf (" (ompaunol in tevest
getch ();
Cutpu oF aogam
Amount 670
Rate
Tme
PuncipQ Amouwt 10
Simple ntevest 6o
(ompoLnd interest ISo
Eyperimert-3
Aim and CrCumferr
oney

wuite
wute a PHgua m to Calulate aIO

ofa Cicl.

ogam Gds
# inctude <stdlo.h
inclucls anio. h
+includ <mah h
Void mah ()

ChsCY(
float r r, aua CY
Puintf (" Enteu vadius ")
Scanf (", f " s7);
Pi314
0ua piPow (3 2);
Ci 2 Pi *
Puntf" Aua = f ", axIa);
Pauintf ( rcunfenenes
"
f", C'x);
gutch C);

Outpu of Puoguam_
*
Enteu adius 2
Awa 12-56
CirCum#euence 12 56
Eyperiment-4
Afm
dh
wuite aPgMa that accepts ha tempenalwu
aurd tht
ent guaa
entgvads conveuts into fahanhtt wing
fr mul a

Puogom Code
#includ Stdio.h>
# incuols (onio.h
void mauh ()

c se C;
int C float F
Puntf (" Ente tempexatw in centigaol
Stanf ("1.d ", &c);
Pauintf (" Fov Fakvonhait "';
F((9/5)"c) +32 ;
Pauint-f ('" fahsanhei't = %f", FJ;
gatch (

Output of opuam
Entex tempexatuwu in centtquod 87
fo Fahunhtt
Fahenhit = id8.6
Expeviment -5
Aim
luite PiOgHam hat of two vasuabler
Sunps valurs
usin a thiud Vauable

Puognam Code
tt include
Stdio. h>
4i'ncud Conioh
void moin ()

chYSC ) ,
int a,b, temp,
Pauntf (" Ento tuo values"J;
Scanf 1d hot", &a bb)i
Pauintf (" 7.d",, a))
a-
stintf ('b= 7d", b);
temp a
a=b
b tempPS
hds b= %d, a, b),
Puintf("\n Afe suappîng, a
getch C)

Output of Pyogsam
Ente tuo alue 58
a 5, b 8
Afte sapping, Q:8, b: 5
Am
ulute a
Huam tho checks
pnttxtd by th
enteto
wey a whathu th
the o niumbe
uwo
r
eoual a not
RuOgomde
+
incudl e stdio.h
+nclud! Conio h
void main (
ClYSCY ();
int a,b
Psuntf ( Tnput the Juo
Scanf ( ld d", ba ,&b):
numbeuJ
if (ab)
Pauntf (" Tho tu numbeo au euas
elae
intf ( n Thi tu0 rumbeu a nat uas";
gttch C,

Output of AHORHam

numbeS 5 5
Tnputtho two
Thetw0 numbCHS aHu eguak
Eypeviment7
numdea

Nln guatest of thi


Puogam to findth
aletite

uam code numberng7


thv gueateat of thtt
to fhd
uguam
Hinclude SHdio h>

+ inclucl Cohio h)
Void mar'n ()
shs (); num 2, num 3
Int numl,
num2 , Num
3 \n J
num1
Enttr the
alws af
Puintf ("
Scanf d %d /d ", &numl, &num2 16huum3 \h
nun3: d
%d t
Puuintf (
numi= %d \t num 2
hum , nNum 2, num3);

I(num! > num 2)

num 3)
# (num! twar
thr n\nJJ;
;
among
1 the guadest
f ("
num
Pacint

elg heu \h/s


d tho geateyt among
nwn 3
su'ntf "

num3) \n);
f(num 2 among thuu
else num 2
thu grealest
Pauntf ("
amorg t h r \n);
amorg thvue
else num 3 is tho Jategt
Punt f ("
9et ch C
Output of Puoguam
Ente th values of Numi, num2 and num3
6 8 10
numi 6 num2 = num3=10

num3 s tho gsutatet Qumong tho


Epeviment -8
m ihat frs thh. a given um
Cdd

uOgam (ode
Hincludi Stdio h>
ihclud (onio.h>
VOId aun ()

cls )
int N
N);
( E t 4hu valuu
Pauntf
Scamf (tol "&N):
(Nh2 - 0)
Psunt f ('N is even

if (N= 0
Psunf ( N is odol );
gotch (;

Out put of Pogrom


of N 5
th valuu
Entev
Nis odo
Experiment 9

8 ven eak
Alma

a puoguam that tes whau a geven Jtu


tulute
leap yea oOY nat

PHOgHamn
code
Cod

i nin cluds Stdioh>


4includ Conio h>
Void m a ( )

cl SCY ();
inta
Ente t h uga );
Psuintf(
Scanf hd ",sa);
if (a 4 ==0)

Psuintf (" Yeau is leap yeau )

elge
nat C leap yea ,
Puint f ('" Yeau

gutch ();

Output of Pogam
Entetho yea 2020
Yeau s leap yea
Expevinent-10
that arepts mouk s of five
subjects
HOgHam
Ai
aluie a to
cvdf hsa pecentag and puints guades accoding
coiteua
Punt A '

Between 90-100
Auint 8
80-90
60-80
exint '
60
Psuint D'
below

BuOgvam Code
# i'nclude <Stdio h>
+include Conio h
Void mai'n ()

chscx C3; Sum


int 0, b C,d,e
float peHCentage s
obtaineod in Math J;
Mauk
Pxintf ("
ba);
SCanf C" %d", in physics")
;
Mavk obtaintd
Pauntf C n
Scanf ( %d'" ,b b);
Mauk obtainad in chuistry:
Psuintf (" n
& c);
SCanf ( %d",
Mauk obtainsol in English "J;
Puintf ( n
Scanf " ). d'', &d); in Mind ");
obtaind
Pauintf (''\n mauk
SCanf( } d'"',&e);
Stm a tbt C td fe,
100
Peucendage = (Sum /500)
entf
n Total maukS %d, Sum) =

aintf C n Peuc entoge f", peurentag« )


=

entage 9 0 A& Peueentog


feucer
=oo)
n Gracds A "):
fuint f

13e
peMCenfoge >80 6pecenta ge = 90)

suint(\n Gvrads ");

do)
'geif( ecentoge 60 A& euctntogi

Pouintf("n Gnods C;

elge

Pxintf(" In Goads D ");

gatch ():

Output of Pogyam
Math 00
fMauk ob tainad in
MONk obtaind th Physics O0
O0

Hauk cbtaingod in chemistry (o0


loo
Mauk obtained n English
Mak Cbtained n Hindi 106
!06

ofa Mauk S 500


Peucentage 100
Gac A
Eyperiment -l1

p1ogam +hat takes tuo opeuards anol on


auulto from the uge and pevform the ope-at lon ad
peaia
perata from

tha Yegult by using


puhts
uitch Statem ent
BNHam ode
+include Stdioh
+ inctude <Cohio.h>
void main ()

cloSCr C);
float
cha n;
Enteuhe valuu o a y
ano n);
eaintf (
&x ,6 y,bn);
Scanf / f %f2C',
Switch (m)

Case
Z X+Y
break
CoSe 2
Z X-Y
bseak
Case3
z X*V;
Break,
02e4
Z /y
pseak
dufault
Pauntf ( Value nad valiol J;
Buindf ( Jmult f",zJ;
9etch ) ;
of fuogram
utput of
10
Entey the valu o , Y and y 2'3 +
+Y =
S. 00 60
Experiment 12
Aim3 all nui0Cis
a Au09uamto Punt
aP
+hu Su o
(ute

9ven Nunber
upto

Puoamn Code
# include Stdio h
# incud Conio h>
Voicl main ( )

CSCr C)
inti Sum : 0 num

a n integty ntmbe»r \n
Pintf ( Ente
Scaf ( %d ", & num)
for(i= 1 <=num ; 11)

Sum: Sum t i
givn nwnioen3 ")
all nu6exs upto
untf "Sum of
Pauintf (" hd", sum);
gatch CJ;

Output of Poram
Entey any number 5

Sum of numbeus upto giveh nmbeo,S 15


al
Experiment -13

uluitete proguam to find thv factoviad of a grveh


nimDe
BregHam
Goda
ode.

t inelude Stdio.h>
Hincluo (onio.hy
vord moin()
clrsy CJ
int fact =1 , n
Psuintf Ente thu num n J ;
Scanf %d ', an)
for (i= 1; fe=n ; i++)

foct fact
*
i;
fad);
ol is %d",
n,
The factosuia of
Psuintf('
gtch C);

autput fthe BroRHam


num 55
Ente he
120
120
55 s
Factauial of
Pogua
Proga m to sunt Sum of even ahd odol
from to N numbea.

Cocde
#include <Stdio.h
H include Conioh
Void main

cIYSC
int N Sum Odd ,Sum fveh , i
Pauintf ('Enten th number ");
Scanf hd",&N); Stun 0dd 0 Sum Eyen =0
fo ( i 0 i N it+)
f ( 2 =o)
Sum beF Sum Even t

S Od
Sum Sum odo +1

Psuintf( Sum of
even numbe , d, Jum Fey
Odd rumb = 2 " , S n cdd
)
Puin+f( Sum Gf
3etch C);
1
numbe 66
the
e eveh
u n be = 12
m 0f
odd numben = 9
m
bxperiment 15
Am a uagam to Puint th fibonacci Sesue
a l t e i t e

ram Code
înclud <Stdio.h
# includt <Conio h>
Vord man ()
chrsc ()
int
int 0 j-1,b,k number J
Bunt (" Put thu last limit for fibonace
Scanf(.o", 4n);
sint(" %d", i);

for (k:; k<=h ,kt*)

b i+i
Rsuintf (" )% d , b);
b

getch C)

Output of Puogram
for tibohacc number 5
Pud the lat limit
O, 11,2, 3
Expeviment -16 22

Afm lte R0guam to check uhehun the


Aim
entetpl umbe &pume nof.
Puogram Code:
# include stdio.h>
+ include Coniohy
vod main ()

clrsc (J
int N Count =o, î;
uint f( &rte any NumberI;
Scanf (hol", k N):

Count t*

f Count c:2)
numberi prime "J
Puintf ( "&rteol

humber nat prmo;


Puint f f ' Entewad

gutch ;
rput of
utput
Paogram -

Numbe5
ary
numben d pmme
n t e u t o l

You might also like