Download as pdf
Download as pdf
You are on page 1of 10
125 ees) ais Rati Crot ef) ol al IG Pt gL wa rgb Program ‘#include ‘void main () { int a[] ={2, 3, 54, 22, 67, 34, 29, 19); 5, 73, 26, 10, 4, 2, 84, 26): int b[) for (inti = 0; i B Le =) hye | 1 Ey | te V encsé | o. [%4— se Gt PHL | 2 ; nal a10e | 1100 | e100 0-99 _ bh Arie reg 5 “be e oy Be ao LipAdter Let, tify ‘ wet nleid lL CEU | aren | pee | Pes -ewitenecstutti_| 5 Uinbsia | ML | Zr Sut yy rt LK BSR] 6 Nested | Do-while While For ete __ Se Lg 7 —-- _} Jae i ae chee 6 _/For| 8 126 (ev) Olney Sgt itd Coth Ad) pigs Sal beso toy mite toe po | Ad | Ae wl —!9 ot . . fad Li Sat fen tet oti Usobasla & a 7 lo Lgiphs 10 or 4_|_2 3 4 5 "6 7 8 o 10 ec La A A B A D c A A apferlasSur btw Maou, ier Ar Mba, 1 2r aa Mibu, 1A PAI 3 Mu, 152+ Ar waied (5 speyn Lewin bige3y AES Ate hf MA PEELE AEA IIE SOIL Mes fle Pog tinh gtd LispherlL ye Liu, 192 Te VUE RISO Te sOL SN SL Ht Se ALG MILLE SA NLL Ft Me Save Time) of Sc3s buf Po tfen gt Siiene thea Chg Fal snsifensfe th ely scant Save Memory) =f SU eH ASIN A get IF ut ger P LL yu kited 18 127 G6) Sanh Get (10th ed) tiga oil (CPU Friendly) JACPU GA EL Sed topud Lewy Alen ALi nein Eek gon Define the Size) eoleyfA- ALA TE (ner enalaledthn HP pl fend Si feu et LES PLE MN BESS IEPA TS sh tL Sorta Mba, 15 dF SL Lohest Seg? for 4 Mig ty het PIP FLA Me te aELZB LL IMS int af) = (€2).{3}.44}); b) for (int i = 0, i< 10, i++) Print(*%d\n*, i); ¢) int al} = (1,2,3,4.5); for (int j = 0; j< 5; +4) printf (%d*, a(j)); d) float ff] = (1.4, 3.5, 7.3,5.9); int size for (int n -1; n « size; n=) printf (%fin", f[n}); ) int count = 0; for(i forint j=i i<6,i--) Ij < 45;) +4) { countt+; (Printf%ecount’ count) we Fete Sud tur? Li to ay Error: Parenthesis is not used in array initialization and Single curly braces are used for 1d array. Error:iSemicolon is missing inside the loop. Error: ).Square bracket is used instead of parenthesis in printf statement. Error: Loop condition never be false. Error: Outer loop never be false. Semicolon is missing at the end of printf statement. 128 Ges) atectges Segh gd Grote) liga at. etal Sur? Ef bit Sr a) OP ‘Output: 25 for (p= 5; p <= 25; p=p +5) sum = sum + 5; printf (‘sum is %d *, sum); b) inti; + for (|= 34; <= 60; i* 2) Ounput! printf"); ¢) for (int i = 50; i<= 50; I++) 4) °) { for G= i,j >= 48, j--) printf (7 =9%d \ n printf (i= Sed, ) inti, ant] = B.3.4.5.6,7, 8) int i,j float art{]= (1.1, 1.2.1 float ar2{]= (2.1, 2.2, 2.3}; for (I= 0;1<3;144) for j= i;)<3;j++) Print(afin", ar if * aczuy* ij) 129 G5) petty eth Gat Cth A) lg set 1 apSxrgefag ILI OUR Program Finclude #include int main) { clrscr(); inti j; forti=t: { S344) for(i=t}<=5:j++) printf"): pet } getch(): } ‘Output A Bc DEF GH KLMN a rgeja, IPL Amps 2 Program Finclude #include int main() forint j=1 <=; j++) printf("%c",ch++); printf("\n"); [Output A BC DEF GHIs cata) Sit Gadd roth ee) gt st Lig FLIR te Cheger tfosin mcd vert Sg hind” Program #include #include #include int main() { cirser(); int a, b, result; . Output printf(‘Enter a base number: "); Enter a base number: 2 scanf("%d", &a); printf(’Enter an exponen scanf("%d", &b); result = pow(a, b); printf("%d*%d = %d", a, b, result); getch (); } EBL Se (GOD A a y Spied Larger Anat hrghiad” Program Fincude #include int maing) { clrscr(); intm, 9; printf("Enter two integer numbers: "); scanf ("%d \n %d", &m, &n); while (n > 0) 1 intr=m %n; m=n; nen } printf ("GCD = %d \n"\m); getch (); } Output Enter two integer numbers: 5 15 GCD=5 131 (<6 ly tl id (roth Jee) paige Sintl (AEA ait) LV get UI £1 RS hin” ‘Solution: #include #include int maing { inti; unsigned long int fact = 1; for(i =n; i> 0; +) fact = fact *i; } printf("%d It" fact); fact=1; } getch); } ‘Output 1 z & 24) 420 720 5040 ath Ail ep hat al hel era fas aackiba Lat fughi so” getch 0; its Program #include include int maing Enter 10 Numbers : 9 { 8 cirsor(); 7 int nurm(10}; 9 printfEnter 10 Numbers :"); 6 for{int i =0;i<10;i++) 5 { 26 scanf("%d\n",&num(iD; s } 4 intf( luct of 1st and | a ” printf("Product of 1st and last number is =%d",num[O}*num[9)); Product of tat and last number is = 36 132 Ges oat) a Lit oth Zee) goign Sill EL tS Lt g ie SHEN BS ILS TA Salhi 6” -Ue%e10 Program Finclude int main © etsery) 4 t= ae ie 2,14,15,16},count=0; Output { “ The Elements greater than 10 in array are: 5 i(aum{i>10) count++; - printf(‘The Elements greater than 10 in array are :%d" count); getch(); Program include include int main) { clrser int 4; i= 10; +4) printf("%d * %d = %d \n*, n, i, n* i): } getch (); 133 & #include int main() { clrser(); int marks{30),total=0; float avg: printf("Enter Marks of 30 students \n"); for(int i= 0;i<30;i+) { scanf("%d\n", &marks[i]}; totalstotal+marks{i; } avg = total/30; printf("Average Marks is =%f *,avg); getch (); } Output Note: All values are entered in consecutive 30 lines; the table refer only example. Enter Marks of 30 students 515 | 600 | 450 | 750 | 650 | 477 | 965 | 1052 | 1014 | 914 614 | 715 | 625 J 525 | 423] 496) | 476. | 1011 | 615 | 698 674 | 748 | 987 | 769°) 87S" | G54") 7546 |" S46 [S64 | 456 Average Marks is = 701.733333 134 (es) patie) Bae int Cot Zed) pig Saal (2g hE 6.51 564,32 a Sgbirs as t> Program Solution: Output: include at1=2 5t1=5 #include 27254 5*2=10 int main() 2°3=6 5°3=15 { 2°4=8 5*4=20 int n=2; 2°5=10 5°8=25 for (int i = 1; is= 10; ++i) 2°6=12 5*6=30 { 2°75 14 5*7=35 printf("%ed * %d = %d \n",n, i," i);, 2°8=16 5*8=40 ye 2°9=18 5°9=45 Pete nier: 2°10=20 5*10=50 n=3; for (int i= 1; i<= 10; ++i) 3423 er1=6 { +28 “25 printf("%ed * 9d = %d \n"pn, i, nD? ars eee ) = = “nin past “— te) te ee n=4; ' ee for (int i= 1; i<= 10; +4i) sea ergs { ‘g= “B= printf("%d * %d =%d Wren, Ina * i); an agea } “4102 *W= prntfCnin"); 3*10= 30 6*10=60 n=5; for (int i= 1; i<= 10; ++i) 4° 1A. { 7 “ 4°28 printf("%ed * %d = %d \n", n,n"); 4°3242 } . » 4°4=16 printf("\n\n"); 4*5=20 n=6; _— 4°6=24 freien 10; ++i) 4*7=28 rintf("%ed * %d = %d In", n, i," i): } . b sascgy 4°10=40 } Output Note: Table should display below to next table and vice versa.

You might also like