Week 11
Week 11
Execution:
# n c l u d e <stdio»h>
Struct Student
age
char name [io
nt mooC)
student name, age
pintf C Entu
,a.age&a. name J
SCaf/ d s
priorf ( \n"
Student data:
vetun D
Page 292 of
368
cOMPUTATIONALTHINKING FOR CTURED DESIGM
Algorithm
foclude <stdfo.h>
ttinclu de <sting.
ttfnclude math.hb>
inchude etoe
rgclode Kquenex
struct peuson
&hnet r
char name l ,
int Job
peson
n t maîn )
a0
j++)
3=o; jen-I-i
eo (int
te (ship 3 . o b >sship lj+1]. job)
peLsonemp
memcpy(2temp shi'plj J, Stze of (pes tn) );
memcpy shipljJ, k Ship ijt1), size of (pess
on))
memcp y(shipljtil, k temp, size dt peson):
3
f fot =o,icn;it+)
li].ngme)
priot+ s \ o " , ship
table
Testcase
Testcase Type Input
Expected
Output after
Resut:Pass/Fail
output execution
Output
S. no Input
Compan-
pfotf ( enter patient durámt, , nge,
Sconf1+0d -). s /. n J s a l t]id ,&ofJ.name Aali
2aCi1.cmplaint ),
3
Execution:
fe i13 i<: n ; i )
retuan 0
of the
Date of Signature
Sigratúre of the Evàluator
COMPUTATIONAL THINKING FOR STRUCTURED DESIGN
Execution
inctude <stdio.h>
Struct studert
3 sis3
int main ()
nt ,
print F" Entes name,
firntyea mais Serone yea mesks
retun O
Test case Table:
Web Link:
https://www.hackerrank.com/contests/beginners-in-c/challenges/dmas/problem
Bishop 366
Algorithmn
*nclude <stdio-h>
tnclude (srdlib.h
tt detne HAX 3
?4 top = = HAx-t)
top ++
Stkltop]=Qdd
Veid dplay ()
E Cto p = -
)
printf (" \n stack s
ee
bpty")
print-\nDetoj a
( i top; 1-o1-)
Page 300 of 368
cOMPUTATIONAL THINKING FOR STRUCTURED DESIGN
Execution:
int moain C)
char blioJ
nE chofce, add,
while C)
lo 3.Exdt ") :
pYnE ( In I. Push In 2.Dsplay
priorf C" In fntes yous choi ce:),
Sltch Cchof ce)
Case 1
Oge
prioTf ( Entes cAaie of vfsito
Scanf( .d ", Ladd )
push Cadd),
break
Case 2
dplay C;
brea
Cose 3
extCo)
3
retuun 0
24 4
27
24,2 24,27 Pa
S IC
uCTURED D
Problem 3:
Passing Structure function arguments. The
as
whole structure
function
is passed to another.
another function by
value. This structure canbe accessed from called
Web Link:
h t t p s : / / w w w . h a c k e r r a n k . c o m / c o n t e s t s / b e g i n n e r s - i n - c / c h a l l e n g e s / s f a 0 0 1
5.
Output
no Input
Algorithm
nclude <stdioh
tnclude <string.h>
Strue ooge
Struch wage e,
ez employ)
Struct e e
priotf C ente tthe name
ScanfC-s'", e name) mgloyee, ")
printf(1d",
Yetun e
aes S) ;
Table:
2
oo Pan
Rorn Ram
SoO Pann
(For Valuator's use only)
Page 30 of 368
STRUCTURED
DESIGN
THINKING FOR
COMPUTATIONAL
E x e c u t i o n :
i n c l u d e <stdlo.h>
Struct enam
nt rol,
tnt mart3
cha name l20J,
ot main ()
3a
fot main)
Phume Pme
o denReine Cpl elen Retaive
Ryhane
Gs Autiva Pos
GouD |GoLD
Output
S. no Input
3
type def struct bo b o
nt get-volume (loox b)
(6.hetkt <41)
R
ee
R
xetusn D
Page 308 of 368
COMPUTATIONAL THINKING FOR STRUCTURED DESIGN
Execution:
fnt mafnt)
nt
scant({.d", LnD;
bex bezey mall (n sizedf (bex)
80
toS 2
S
20 Pad
(For Evaluator's use onl)
,)
Sighatyreof the Evaluator Date of Evaluation:
Algorithm
n c l u d e <stdio.h>
struc employee
fnt employee_fd;
dong fn Salauy;
int dd
int mms
fnt 993B
3d
3e
int mainC)
e.employe-
S 4Sd 1d d d
Scanftd ed.o, xe.d.yIY)
e.name,ae.d.salaty ,
ename, e.d.salauy,
e.d. dde.d. mm e:d999)
setuun 0