0 ratings0% found this document useful (0 votes) 107 views21 pagesAlgorithm and Flowchart
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Q) Orite a C program to check if a numb
Positive 1 Negedive or 2eru.
Obyetive =
Cc program to dina id the number is posite g
Neyatve or zevo. I will provide she algori th n
Gnd a flowchart fo help yuu tnd ev stand
loyic
Algorithms
) Start
2) Read a variable n
3) Check iJ n if @yals to O , then
Print number is 2er0-
4) Else if nis greater then O, then
Print number iS Positive -
S) Else
print number iS neg ative .
6) EndQxy Urite oe C programe to calculate Cum
ot chigit 4 CeO:
Objective + |
C Programe to calculate the Sum 6 digit 4 a
t= vill provide the algorithm and
namber .
Q Jlowchart fo help you understand the logic.
Algorithm -
\y Start
Read a variable n
3) Set a variable Sum a> 0
4) while nis not eqral to OF 0
set a variable Kk o& n %o 10
set n= n /l0
set Sum = sum tk
S) Ena of hile loop
6) Print Sum
> EndEEE
Plow chart =
en 7.10
n= n/lo
Sum = sum + k
era ee A
— &
Print SumyANN TA
Qy Unite a C Program to Jind sum of alf even
numbers betvuem 1 to n, Lhere w will be
taken on input
Objective -
C program to gind sum of aff even number §
between 14 to n where n will be taken an
input . Twill provide the algorithm and a
Jlowchart to help you understand the logic
Algorithm
ty Start
2) Read a variable n
3) Set a variable sum oF 22” Co).
infor et fo nian. Str G) leer)
Check D iis complete ly divisi ble by 1, then
Set Sum = Sum +4
Else 4° to step 4.
S) Ena of dor logp.
6) Print Sum
7) EndFlos chart=Qry Write a C Program to enter a number and
Prinb its reverse Using hile loop -
Objective
C program to enter G number and print
reverse Gainy while luop . L will provide thé
algorithm and a dlow chart to help You Understand
the logic
Algorithm +
v) Start
2D Read variable n
t a variable rev o> Zero:
3) of
w bhle n 1S not eqpat to ©, do
cy el
its
set a variable
set n on n/lO
set rev on rev * lotk
S$) End while loop
6) Print vev
D EndRevere 10 4
n=hA0
nev = ney¥ lotk,ee Oe Program +o input marks i
oo physics , chemistry ; biology, on
computers. Calculate percenta 4
Grade ae cording to +the illo, -
Percentage >= 40% ; Grade A
Percentage >= 9O% ar pale
Percentage > = 7O Yo me Urede
Percentage > = 60 % : Grade 1D
Percentage > = Yo% : Grade E
Percentage < wWov% : Grade F
Quer sew
Objectiv +
C program to caladate percent ond print grade of
il provide the algorithm and
5 subject marks. I wi
tand the logic
a Jlow chart 4o help you undersAlgorithm : L
') Start
D Read Jive voriable p,c,m, b, co dor marky
ej five subjects
3.
) Calcul ate the sum of the marks of subjects
&
YCalalate the percent of the nares drom the
Sum Calelated and store it ih & voriable per:
S) Check if per is eqpol fo or greater than 90,
than
Print grade A
6) Else if per is eqpal to or grecder
than G0 , then
Print grade B
%) Else i} per is Cqpal t
thar @o , then
Part grade €
%) Else id per is equal to or greater
than 70 , then
Print grade 0
is eyed to oF grecter than 410 and
than GO and lend
oO Or greeter than O and les
than 60 ancl ler
ay Else if per ke
tan GO, thor
Print grade fe
toy Else
Print grade F
") End s
ae
oe ee eeCen Es ONO AN VINFIaN Ie WUMberS
Flow chart »
arnge one Sf
/Read p,c,m ) b, Co)
rae 7
by is agnesiil zi s
b + cu) * 100 /500 |
\Set_ per = Cat+c+ m+
Ne ie 3/ Pt Grade af >
. Grate”
so seo
perss 806k ~, True »/ Print
per <40_ caer
= y
ak
a, a int, Grede C/
m = Wo bh per
W.
termi aa
ERIE =. Fi ‘
spb f= nemainder * pemainder * jemaind er
v
I
Ls
nesult == original [Pret resbrcrg terete
<= so
aleQay (nite a C
Program to ch
number i$ ane number a S
Objeckv .
C program to check whether G humber is prime no.
oF not. I will provide the algorithm Gnd flowchart
bo make You Understahd the logic,
Algorithm
t) Start
2) Read a variable n
3)fon ie—-i bn step of 4 do
4) Checle iJ n is completely divisible by 4
Set a variable c a» © increne it byt.
3) Else
ee Move to step 3
6) End o} Jor loop
D Check if ¢ 1 equal to 2
Print Prime number.
&) Else prime number
Print not @
9) Endfl
law chart
Print number is not Prime, >
8 ee,
—
v
eh
W Ty ue
cee
THe
S/ Pant number is prme
FaleQioy Lrite a C Programe to calaulate the Jactorial
¢) Qa number tring dor loop.
Objective ~
Cc Program to calwate the dactorial o) a number
Gaihg dor loop. I will provide the algorithm &
Jlow chart to make you understand the lac.
Algorithm S
) Start
2) Read variable n
3) Set a variable doc ant
4) fon ig—n tot ih decree of 1, do
Calcul ate Jace foc vi
S) End of Jor loop
6) Print Joc
2) EndFlowchart +