Structured Programming, Assignments of C programming

This is a solution to an assignment. The course name is Structured Programming for Engineering Students.

Typology: Assignments

2025/2026

Available from 05/24/2026

sanimul-rahat
sanimul-rahat 🇧🇩

2 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8

Partial preview of the text

Download Structured Programming and more Assignments C programming in PDF only on Docsity!

TD fis alee a C Preypam {o dake impel ol | inlese rr , toad ; double ; chanaclen and bollen i i type dala and display if. Anss H include csidio.h> ind main ( ) } in inleger Valee float float Value; double double Yale: chat Chanacten Value; m+ boolenValue : 7 | printf (“Eater an ae Value : i | | Seon (“td " & indejen alae)» | pond f Cele a toa Value | “). Sean | (ahs aa floatvalue): prin f (“Enter a double Value ,"): Sean f ("y, if" f£ double Value), prin} | (“Enter @ Characten ot). 'Scan { (%0% f Chanacten Value), ‘print 4 (Bates a boolean Yalue (oon i): "); Scan | ("%d" £ boolenYalue); - - 7 prin} J (“\n Lntened Valees:\n a0 prind j (2 A nlejen = ‘nd \n', integer ‘Yalue): , print 4 " Float = hot \n 7 ie en Value): | prinf | y Double = 7,12 if \n", double Value): prin} | (“Character = %¢e\n" Characten Value): / print } (“Boolean = % d \xq " booleanValue) ; peturn o; i | Case 2' | print {[PEnlen bediws: ") com | ("ud", £ padius); | print | (“Anea of dinele = “7°2 hadius): | break; | Case 3; f | print { (“Ender padius: "ys ij | Scan (“nb, # padius): | prinf | (‘Surface Anea. of SPhene = y-24\n" +4 ¥ PI ¥ padius ¥ padius) br eaks |\Case 4 | print t (“Pregram Ended-\n"); | break, deleeth prin $ (“Invalid Choice | \n); f J While (choice 12 4) / J\n", pr x padius* | betunn oO; j —+-— 13. Write acd preqram to caleulate dhe Jina pe he of a Studen} based on their exam Score: Ans: # include zadiodh> in yacin CL | float examScaone , bonus, penalty , finalémade + | print 4 ag Enlen exam Score "\. goan | (7b, & exam Scone)! | if (examScone Za 4c) f | bonis = examscaone ¥ 0102) Penalty = examgaone¥ Ools { else it (examsoone “= Zo) f bonuS = ExamsScone ¥ 0105 } penalty = Cxam Scone ® 9,02 , 4 else } bonus = Examscone * 2.08) panelty = exam Scone 4 0:05) 4 | Final Grade = examScore + bonus - Penalty . print f (7 Eince| Ginade = Z24\n" Jineldinade) peturn oO» / / 4 ay @ 5, Write a C proyram to Seanah an len trom a Hoating type annay. The array | elements and ‘Search item Comes trom |USen inpat Use while loop. | Ans: + inclade Zstdio. hy | int main () f int i,n, tound = 0, toot ann [lool], Seanch, print (“Enter number of elements ! ")y | scan } (7d 2 n): print + (” Enter arpay dement. \n) for (iso; ign; i++) } Seant("yf» £ arp til); | “print + (“Enter Value to Seanah : a Scant ("4% P Seanah); fon (iso; ign; ins) } it (opp Lil =: Seanch) f found = 1; break; | 5 tit (Jound rs ) print £ ("Tem hog a+ peeion hd \ny j ‘ / else Ly +4), int (“Tem J (prin no4 rid « wey) ipetunn 0) _— ij ae ne 5 Find GCD-LCM, GW | C_ proqram nije @ P J Separate Tuna ion. Factonial Sum Usin Ans: 4 include Zsldio-h> in ged (int a, intb) f while (b!=0) { int emp = b; b= a%b3 a= temp, { belunn a; 4 int Jem (intasand int b) { peturn (ax b) /ged (a,b); 4 int tactonial Cint wn) ! ind | , aad = I; for Ci=1; igen; i++) ‘i dans fact ai; | petunn fret, jind main () i int num, num 2} [print (“Entem two Numbers | "); Sean t (hd vad" & num, 2 nam2) | Print { ("“Giep = %d \n " print} (Lam = ydane | } ged (nam 1 num 2))3 » lam (num), n , sai ("Sum of Faclonials - td \n am 2)) acto rial (num ') + fa torial ‘ lpehunn ne a Ss (muma))3 3