The document contains code snippets for several C programs that perform tasks like:
1) Displaying numbers in ascending and descending order using for loops.
2) Checking if a number is even or odd using if/else statements.
3) Finding the largest number among three input numbers.
4) Checking if a year is a leap year based on various divisibility rules.
5) Calculating the arithmetic mean of n input numbers.
The programs demonstrate the use of basic C programming constructs like loops, conditional statements, functions to solve problems like number sorting, arithmetic calculations etc.
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
50 views
C Lab Programs 3
The document contains code snippets for several C programs that perform tasks like:
1) Displaying numbers in ascending and descending order using for loops.
2) Checking if a number is even or odd using if/else statements.
3) Finding the largest number among three input numbers.
4) Checking if a year is a leap year based on various divisibility rules.
5) Calculating the arithmetic mean of n input numbers.
The programs demonstrate the use of basic C programming constructs like loops, conditional statements, functions to solve problems like number sorting, arithmetic calculations etc.
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 32
Display numbers in ascending and descending order
#include< stdio.h >
#include< conio.h > void main() { int i=0; clrscr(); printf(" \nNumers in ascendin! order "\n"); for (;++i<=10;) printf(#\t$%d&'i); printf(#\n\n&); printf(" \nNumers in descendin! order "\n"); for (;i-- >1;) printf(#\t$%d&'i); } Program o c!ec" enered number is odd or e#en #include< stdio.h > #include< conio.h > void main() { int ('); clrscr(); printf(" \n*nter the Numer "\n"); scanf("$d"'+(); s$ic!(%) & 'ase 0( printf(" \n Numer is even "\n"); brea"; 'ase 1( printf(" \n Numer is odd "\n"); brea"; defaul y=%)*; s$ic! (y) & 'ase 0( printf(" \n Numer is even "\n"); brea";
defaul (
printf(" \n Numer is odd "\n"); } } +ec!(); } ,r #include< stdio.h > #include< conio.h > #include<stdli.h> void main() { int (; clrscr(); printf(" \n*nter the Numer "\n"); scanf("$d"'+(); if(%)*==0) goo e#en; else goo odd; even" printf(" \n $d is *ven numer "\n"); reurn; odd( printf(" \n $d is odd numer"\n"); } ' program o prin !o$ many prime numbers are !ere from 1 o -0. ,ere is a simple pro!ram to !enerate prime numers upto a !iven specific numer /include<sdio0!> /include<conio0!> #oid main() & in i121n; prinf(3 4ner !e number upo $!ic! $e !a#e o find !e prime number( 3); scanf(3)d315n); prinf(36n3); for(i=*;i<=n;i++) & for(2=*;2<=i-1;2++) if(i)2==0) brea"; 778umber is di#isble by some o!er number0 9o brea" ou if(i==2) prinf(36)d31i); 778umber $as di#isible by iself (!a is1 i $as same as 2) }77'oninue loop upo n! number gec!(); } $rie a program o find ou $!e!er a gi#en number is prime or no0 main() { int a'c=0'i'n; printf("enter the numer to e chec-ed"); scanf("$d"'+n); for(i=.;i<=n;i//) { a=n$i; if(a=0) { c=c/.; 0 0 if (c=1) { printf("the !iven numer is prime"); 0 else printf("the !iven numer is not prime"); 0 or #include<stdio.h> #include<conio.h> void main() { int no'i; clrscr(); printf(" *nter the Numer 2 3ant to chec-""); scanf("$d"'+no); i=1; 3hile(i<=no4.) { if(no$i==0) { printf(" $d is not 5rime numer"'no ); rea-; 0 i=i/.; 0 if(no==i) printf("$d is a prime Numer"'no); !etch(); 0 6r main() { int a'c'i'n; printf("enter the numer to e chec-ed"); scanf("$d"'+n); if(i=.++i<=n++i//)
a=n$i; if(a=0) { c=c/.; 0 0 if (c=1) printf("the !iven numer is prime"); else printf("the !iven numer is not prime"); 0 program !a c!ec"s number is -#e or +#e and con#ers o +#e if -#e 10 / include <sdio0!> 77:nclude !e sdio0! file *0 #oid main () 77 sar of !e program ;0 & <0 in numbers ; 77 declare !e #ariables -0 prinf (3=ype a number(3); 77 message o !e user >0 scanf (3)d31 5number) ; 77 read !e number from sandard inpu ?0 if (number < 0) 77 c!ec" $!e!er !e number is a negai#e @0 number A0 number = -number; 77 if i is negai#e !en con#er i ino 100 posii#e 110 prinf (3=!e absolue #alue is )d 6n31 number); 77 prin !e 1*0 #alue 1;0 } Prin !e gi#en numbers along $i! !e larges number of !em 10 /include <sdio0!> 77includes !e sdio0! file o your program *0 main () 77sar of main funcion ;0 & <0 in a1b1c1big 77declaraion of #ariables -0 prinf (34ner !ree numbers3) 77message o !e user >0 scanf (3)d )d )d31 5a1 5b1 5c) 77Bead #ariables a1b1c1 ?0 if (a > b) 77 c!ec" $!e!er a is greaer !an b if rue !en @0 if (a > c) 77 c!ec" $!e!er a is greaer !an c A0 big = a ; 77 assign a o big 100 else 110 big = c ; 77 assign c o big 1*0 else 1;0 if (b > c) 77 if !e condiion (a > b) fails c!ec" $!e!er b 1<0 is greaer !an c 1-0 big = b; 77 assign b o big 1>0 else 1?0 big = c; 77 assign c o big 1@0 1A0 prinf (3Carges of )d1 )d 5 )d = )d31 a1b1c1big); 77prin !e *00 gi#en numers alon! 3ith the lar!est numer 1.. 0 Ceap Dear program in ' E year $ill be a leap year if i is di#isible by < (1AA>) bu no leap year if di#isible by 1000 (*100) :f a year is di#isible by < and by 1001 i is no a leap year (*100) :f i is di#isible by <00 e#en if di#isible by 100 00i is leap year(*000) /include <sdio0!> /include <conio0!> #oid main() & in y; prinf(3ener !e year3); scanf(3)d315y); if(y)100==0) & if(y)<00==0) & prinf(3)d is leap year3); } else & prinf(3 )d is no a leap year3); } } else & if(y)<==0) & prinf(3)d is a leap year3); } else & prinf(3)d is no a leap year3); } } gec!(); } Fse of 4lse :f Cadder /include #oid main () & in mar"s; clrscr (); prinf (34ner mar"s(3); scanf (3)d31 5mar"s); if (mar"s>A0) prinf (34%cellen3); else if (mar"s>?-) prinf (3Gery good3); else if (mar"s>>0) prinf (3+ood3); else if (mar"s>-0) prinf (3E#eraged3); else prinf (3Gery poor3); gec! (); } 4%ample program for generaing H8I 8aural numbers using $!ile loop( / include < sdio0! > 77include !e sdio0! file #oid main() 77 9ar of your program & in n1 i=0; 77Declare and iniialiJe !e #ariables prinf(K4ner !e upper limi numberL); 77Message o !e user scanf(K)dL1 5n); 77read and sore !e number $!ile(i < = n) 77 N!ile saemen $i! condiion & 77 Oody of !e loop prinf(K6)dL1i); 77 prin !e #alue of i i++; 77incremen : o !e ne% naural number0 } } Program prins firs 100 numbers !a are di#idable $i! ?( #include <stdio.h> void main() { int i=0' n=0; 3hile (n < .00) { if (i $ 7 == 0) { printf ("$d\n"' i); n//;
0 i//; 0 0 =ry !e follo$ing program1 $!ic! as"s for a number be$een 1 and A1 and loops around unil a #alid number !as been enered(- /include <sdio0!> /include <conio0!>
main() &
in num;
do & prinf(34ner number 1-A( 3); scanf(3)d315num); } $!ile ((num<1) PP (num>A));
prinf(3Dou c!ose )d0 Press a "ey031num); gec!();
} 8)pical output for this mi!ht e"4 4ner number 1-A( 10 4ner number 1-A( 0 4ner number 1-A( 1- 4ner number 1-A( -- 4ner number 1-A( ; Dou c!ose ;0 Press a "ey0Q Fse of brea" saemen #include <stdio.h> int main() { char c; for(;;) { printf9s( "\n5ress an) -e)' : to ;uit" " ); << =onvert to character value scanf9s("$c"' +c); if (c == >:>) rea-; 0 0 << ?oop e(its onl) 3hen >:> is pressed
Fse of brea" saemen #include <stdio.h> int main() { int i; for (i = .; i < .0; i//) { printf9s("$d\n"' i); if (i == @) rea-; 0 0 << ?oop e(its after printin! . throu!h @ ,upu . 1 % @ 'onsider !e follo$ing program !a finds !e sum of fi#e posii#e inegers0 :f a negai#e number is enered1 !e sum is no performed since !e remaining par of !e loop is s"ipped using coninue saemen0 /include < sdio0! > 77:nclude sdio0! file #oid main() 77sar of !e program & in num1 sum=0; 77 declare and iniialiJe !e #ariables for (i = 0; i < =-; i++) 77 for loop & prinf(K4ner !e inegerL); 77Message o !e user scanf(K)dL1 5num); 77read and sore !e number if(num < 0) 77c!ec" $!e!er !e number is less !an Jero & prinf(KDou !a#e enered a negai#e numberL); 77 message o !e user coninue; 77 sars $i! !e beginning of !e loop } 77 end of for loop sum+=num; 77 add and sore sum o num } prinf(K=!e sum of posii#e numbers enered = )dL1sum); 77 prin !e sum0 } 77 end of !e program0 Ror loop e%ample program( 9um of firs 1- posii#e e#en numbers and !eir sSuares /include < sdio0! > 77:nclude sdio0! file #oid main() 77sar main program & in i; 77declare #ariable in sum=01sumQofQsSuares=0; 77declare and iniialiJe #ariable0 for(i=0;i < = ;0; i+=*) 77for loop & sum+=i; 77add !e #alue of i and sore i o sum sumQofQsSuares+=iTi; 77find !e sSuare #alue and add i o sumQofQsSuares } 77end of for loop prinf(K9um of firs 1- posii#e e#en numbers=)d6nL1sum); 77Prin sum prinf(K9um of !eir sSuares=)d6nL1sumQofQsSuares); 77prin sumQofQsSuare } Nrie your o$n program !a $ill calculae ari!meic middle of n gi#en numbers0 #include <stdio.h> void main() { int i' n' sum' (; float arit9midd; printf("Aor ho3 man) numers do )ou 3ish to calc. their arithmetic middle " "); scanf("$d"' +n ); sum = 0; for(i=0; i<n; i//) { printf("Bive $d. numer " "' i); scanf("$d"' +(); sum /= (; 0 arit9midd = (float) sum < n; printf("Crithmetic middle of scanned numers is $f\n"' arit9midd); 0 able program(- /include <sdio0!> /include <conio0!> /include <cype0!> /define MEUQ=EOC4 10 main() & in num11 num*1 resul; for (num1=?; num1<=MEUQ=EOC4; num1++) & prinf(3)*d imes able6n31 num1); prinf(3==============6n3); for (num*=1; num*<=MEUQ=EOC4; num*++) & resul = num1 T num*; prinf(3)*d % )*d = );d6n31 num*1 num11 resul); } gec!(); clrscr(); } } !ereVs a sample screen oupu(- ? imes able $ill be prined Program reads sudenIs grade gi#en from "eyboard (from 1 o -) and prins iIs descripion0 #include <stdio.h> void main() {
int !rade; printf ("Dnput !rade ""); scanf("$d"' + !rade); s3itch (!rade) { case ." printf("Aail (A)\n");rea-; case 1" printf("Ead (F)\n");rea-; case %" printf("Bood (=)\n");rea-; case @" printf("Ger) Bood (E)\n");rea-; case H" printf("*(cellent (C)\n");rea-; default" printf("Iou have inputted false !rade\n"); rea-; << rea- isnJt necessar) here 0 0 4%ample program on 9$ic! 'ase( /include <sdio0!> /include <conio0!> /include <cype0!> /define =BF4 1 /define 9=EB=4BQ',9= ;0A- /define ME:8Q',9= @0A- /define D4994B=Q',9= ;0-0 main () & c!ar c!; floa cos1oal; oal = 000; do & prinf(3'!oose one of( (9)arer1 (M)ain1 (D)esser1 e(U)i( 3); c!=oupper( gec!e() ); prinf(36n3); s$ic!(c!) & case(V9V)( prinf(39arer included3); cos=9=EB=4BQ',9=; brea"; case(VMV)( prinf(3Main included3); cos=ME:8Q',9=; brea"; case(VDV)( prinf(3Desser included3); cos=D4994B=Q',9=; brea"; case(VUV)( prinf(3Program finis!ed3); brea"; defaul( prinf(3:ncorrec c!oice0 =ry again6n6n3); coninue; } 7T end of s$ic! T7 prinf(36n3); if (c!==VUV) brea"; prinf(3'os of c!oice )c is )<0*f6n31 c!1 cos); oal+=cos; prinf(3=oal cos is )-0*f6n6n31 oal); } $!ile (=BF4); gec!(); } C t)pical output from the pro!ram mi!ht loo- li-e this '!oose one of( (9)arer1 (M)ain1 (D)esser1 e(U)i( s 9arer included 'os of c!oice 9 is ;0A- =oal cos is ;0A-
'!oose one of( (9)arer1 (M)ain1 (D)esser1 e(U)i( m Main included 'os of c!oice M is @0A- =oal cos is 1*0A0 '!oose one of( (9)arer1 (M)ain1 (D)esser1 e(U)i( d Desser included 'os of c!oice D is ;0-0 =oal cos is 1>0<0 '!oose one of( (9)arer1 (M)ain1 (D)esser1 e(U)i( p :ncorrec c!oice0 =ry again =!e same abo#e program using :f saemen /include <sdio0!> /include <conio0!> /include <cype0!> /define =BF4 1 main () & c!ar c!; floa cos1oal;
oal = 000; do & prinf(3'!oose one of( (9)arer1 (M)ain1 (D)esser1 e(U)i( 3); c!=gec!e(); c!=oupper(c!); 7T alernai#ely c!= oupper( gec!e() ); T7 prinf(36n3); if (c!==V9V) & prinf(39arer included3); cos=;0A-; } else if (c!==VMV) & prinf(3Main included3); cos=@0A-; } else if (c!==VDV) & prinf(3Desser included3); cos=;0-0; } else if (c!==VUV) & prinf(3Program finis!ed03); brea"; } else & prinf(3:ncorrec c!oice0 =ry again03); coninue; } prinf(36n'os of c!oice )c is )<0*f6n31 c!1 cos); oal=oal+cos; prinf(3=oal cos is )-0*f6n6n31 oal); } $!ile (=BF4); gec!(); } 7T Program o coun !e no of posii#e and negai#e numbers enered in an arrayT7 /include< sdio0! > #oid main( ) & in aW-0X1n1counQneg=01counQpos=01:; prinf(K4ner !e siJe of !e array6nL); scanf(K)dL15n); prinf(K4ner !e elemens of !e array6nL); for :=0;: < n;:++) scanf(K)dL15aW:X); for(:=0;: < n;:++) & if(aW:X < 0) counQneg++; else counQpos++; } prinf(K=!ere are )d negai#e numbers in !e array6nL1counQneg); prinf(K=!ere are )d posii#e numbers in !e array6nL1counQpos); } 7T e%ample program o add $o marices 5 sore !e resuls in !e ;rd mari% T7 #include< stdio.h > #include< conio.h > void main() { int aK.0LK.0L'K.0LK.0L'cK.0LK.0L'i'M'm'n'p';; clrscr(); printf(#enter the order of the . st matri(\n&); scanf(#$d$d&'+m'+n); printf(#enter the order of the 1 nd matri(\n&); scanf(#$d$d&'+p'+;); if(m==p ++ n==;) { printf(#matri( can e added\n&); printf(#enter the elements of the matri( a&); for(i=0;i < m;i//) { for(M=0;M < n;M//) scanf(#$d&'+aKiLKML); 0 printf(#enter the elements of the matri( &); for(i=0;i < p;i//) { for(M=0;M < ;;M//) scanf(#$d&'+KiLKML); 0 printf(#the sum of the matri( a and is&); for(i=0;i < m;i//) { for(M=0;M < n;M//) cKiLKML=aKiLKML/KiLKML; printf(#$d\t&'cKiLKML); printf(#\n&); 0 0 Program o prin sring in !e re#erse order #include< stdio.h > #include< conio.h > void main() { static char sK.HL; Dnt i; clrscr(); puts(#*nter a Ntrin!"&); !ets(s); puts(#Oeverse Ntrin!"J); for(i=.H;i>=0'i44) printf(#$c&'sKiL); 0 Nrie a program o e#aluae !e follo$ing series 9=1Y+*Y+;Y+ZZ #include< stdio.h > #include< conio.h > #include<math.h> void main() { static int s;rK.HL; Dnt M.n.s=0; clrscr(); prinf(K4ner !e #alue of n6nL); scanf(K)dL15n);
for(i=0;i < n;i//) s;rKiL=po3(i/.'1);
for(i=0;i < n;i//) { printf(#$d\t&'s;rKiL)); N=s/s;rKiL; 0 prinf (3=!e sum of sSuares is )d 6n31 s); 0 Nrie a program o display !e elemens of * dimensional array #include< stdio.h > #include< conio.h > void main() { Dnt i'M; int aK%LK%L={{.'1'%0'{@'H'P0'{7'Q'R00; clrscr(); prinf (34lemens of an array 6n6nL);
for(i=0;i < %;i//) { for(i=0;M < %;M//) printf(#$Hd\t&'aKiLKML); printf(#\n&); 0 Bead !e mari% of order up o 10%10 elemens and display !e same in !e mari% form #include< stdio.h > #include< conio.h > void main() { Dnt D'M'ro3'col'aK.0LK.0L; clrscr(); prinf (34ner !e order of !e mari% upo 10%10( 6n6nL); scanf(K)d)dL15ro$15col); prinf (34ner !e order of !e mari% 6nL);
for(i=0;i < col;i//) printf(#$Pd\t&'aKiLKML); printf(#\n&); 0 0 Bead !e mari% of order up o 10%10 elemens and ranspose is elemens #include< stdio.h > #include< conio.h > void main() { Dnt i'M'ro3.'ro31'col.'col1'aK.0LK.0L'K.0LK.0L; clrscr(); prinf (34ner !e order of !e mari% upo 10%10( 6n6nL); scanf(K)d)dL15ro$115col1); prinf (34ner !e elemens of !e mari%6nL); for(i=0;i < ro3.;i//) { for(M=0;M < col.;M//) scanf(K)dL15aWiXW2X); 0 Bo$*=col1; 'lo*=ro$1; for(i=0;i < ro3.;i//) { for(M=0;M < col;M//) bW2XWiX=aWiXW2X); 0 prinf (3Mari% ranspose is 6n6nL); for(i=0;i < ro31;i//) { for(M=0;M < col1;M//) prinf(K)<dL1bWiXW2X); printf(#\n&); 0 Program o perform addiion and subracion of $o marices $!ose order are upo 10%10 #include< stdio.h > #include< conio.h > void main() { Dnt i'M'ro3.'col.'aK.0LK.0L'K.0LK.0L; clrscr(); prinf (34ner !e order of !e marices upo 10%10( 6n6nL); scanf(K)d)dL15ro$115col1); prinf (34ner !e elemens of !e mari% E(66n6nL); for(i=0;i < ro3.;i//) { for(M=0;M < col.;M//) scanf(K)dL15aWiXW2X); 0 prinf (34ner !e elemens of !e mari% O(66n6nL); for(i=0;i < ro3.;i//) { for(M=0;M < col.;M//) scanf(K)dL15bWiXW2X); 0 prinf (3Mari% Eddiion( 6n6nL); for(i=0;i < ro3.;i//) { for(M=0;M < col.;M//) printf(#$Pd\t&'aKiLKML/KiLKML); printf(#\n&); 0 prinf (3Mari% 9ubracion( 6n6nL); for(i=0;i < ro3.;i//) { for(M=0;M < col.;M//) printf(#$Pd\t&'aKiLKML4KiLKML); printf(#\n&); 0 Betch(); 0 Program o perform muliplicaion of $o marices $!ose order are upo 10%10 #include< stdio.h > #include< conio.h > void main() { Dnt i'M'ro3.'col.'aK.0LK.0L'K.0LK.0L; clrscr(); prinf (34ner !e order of !e marices upo 10%10( 6n6nL); scanf(K)d)dL15ro$115col1); prinf (34ner !e elemens of !e mari% E(66n6nL); for(i=0;i < ro3.;i//) { for(M=0;M < col.;M//) scanf(K)dL15aWiXW2X); 0 prinf (34ner !e elemens of !e mari% O(66n6nL); for(i=0;i < ro3.;i//) { for(M=0;M < col.;M//) scanf(K)dL15bWiXW2X); 0 prinf (3Mari% Muliplicaion( 6n6nL); for(i=0;i < ro3.;i//) { for(M=0;M < col.;M//) printf(#$Pd\t&'aKiLKMLSKiLKML); printf(#\n&); } gec!(); } 'ompue facorial of any number using do $!ile loop and also $!ile loop #include< stdio.h > #include< conio.h > void main() { int a'fact=. clrscr(); printf(" \n*nter the Numer "\n"); scanf("$d"'+a); do { printf(#$dS&'a); fact=factSa; a44; } $!ile(a>=1); printf(#\t=$d&'fact); printf(" \nAactorial of the Numer is $d\n"'fact); } ,r #include< stdio.h > #include< conio.h > void main() { int a'fact=. clrscr(); printf(" \n*nter the Numer "\n"); scanf("$d"'+a); $!ile(a>=1) { printf(#$dS&'a); fact=factSa; a44; } printf(#\t=$d&'fact); printf(" \nAactorial of the Numer is $d\n"'fact); } Nrie a c program o e#aluae !e follo$ing series 0Essume suiable #alues for %0 D=1+%*7*[+%<7<[+%>7>[+ZZupo 10 erms /include<sdio0!> /include<conio0!> /include<ma!0!> #oid main() & in i1n1%; floa 1s; clrscr(); prinf(3ener !e #alue of "1n 6n3); scanf(3)d)d315%15n); =1; s=1; for (i=1;i<=n-1;i++) & =((po$(%1*)T(Ti))7((*Ti)T((*Ti-1)Ti)); s=s+; prinf(3s=)>0<f 5 =)>0*f6n31s1); } prinf(36n sum of !e series=)-0<f6n31s); gec!(); } 7T'program o add1 subrac and muliply $o comple% numbers in main (#oid) & in aQreal1aQimaginary12; in bQreal1bQimaginary; in comple%Qnumber; c!ar enerQoperaor; prinf (3a real = 3); scanf (3)d315aQreal); prinf (3a imaginary = 3); scanf (3)d315aQimaginary); prinf (3b real = 3); scanf (3)d315bQreal); prinf (3b imaginary = 3); scanf (3)d315bQimaginary); prinf (34ner operaor = 3); scanf (3)c315enerQoperaor); if (enerQoperaor == V+V) comple%Qnumber = (aQreal+bQreal)+2(aQimaginary+bQimaginary); prinf (36ncomple% number is )d6n31comple%Qnumber); else if (enerQoperaor == V-V); comple%Qnumber = (aQreal-bQreal)+2(aQimaginary-bQimaginary); prinf (36ncomple% number is )d6n31comple%Qnumber); else if (enerQoperaor == V7V); comple%Qnumber = ((aQrealTbQreal+aQimaginaryTbQimaginary)7 (bQrealTbQreal)+(bQimaginaryTbQimaginary))+2((aQimaginaryTbQreal- aQrealTbQimaginary)7(bQrealTbQreal+bQimaginaryTbQimaginary)); prinf (36ncomple% number is )d6n31comple%Qnumber); else if (enerQoperaor == VTV); comple%Qnumber = ((aQrealTbQreal)-(aQimaginaryTbQimaginary)) +2((aQrealTbQimaginary)+(aQrealTbQreal)); prinf (36ncomple% number is )d6n31comple%Qnumber); reurn 0; } =!is program is o c!ec" a gi#en number is prime or no #include< stdio.h > #include< conio.h > #oid main() & int i'(=1; clrscr(); printf("\n*N8*O CNI N2TE*O"); scanf("$d"'+i);
do { if(i$(==0) & printf(" \n Numer $d is not prime "\n"'i); !etch(); e(it(0); } U//; 0 3hile ((<i)
printf("\n Numer $d DN N68 5ODT*"'i); !etche(); 0 Program o prin !e enered number in re#erse order #include< stdio.h > #include< conio.h > void main() { int n'd'(=.; int i; clrscr(); printf(" \n*nter the Numer of di!its"\n"); scanf("$d"'+d); printf(" \n*nter the Numer to e reversed "\n"); scanf("$d"'+n); printf(" \nOeversed Numer is "\n"); 3hile ((<d) { i=n$.0; printf(#$d&'i); n=n<.0; (//; 0 Betche(); 0 'on#er decimal number o binary number #include< stdio.h > #include< conio.h > void main() { int (')=@0; clrscr(); printf(" \n*nter the decimal Numer "\n"); scanf("$d"'+(); printf(" \nEinar) Numer "\n"); 3hile ((V=0) { Boto()()44'%); <<Einar) its correspondin! to the decimal numers 3hich are otained are ta-en in the reverse order ) usin! !oto()() function 'first ar!ument provides the column position and the second provides the ro3 numer 3here output is to e displa)ed. printf(#\t$d&'($1); (=(<1; } } 'on#er binary number o decimal number #include< stdio.h > #include< conio.h > #include<process.h> int a''WK.0L'i; clrscr(); void main() { printf(" \n*nter the Numer of its "\n"); scanf("$d"'+); printf(" \n*nter the inar) its "\n"); scanf("$d"'+WKiL); a=JW0X; for (i=0;i<(b-1);i++) { a=aS1/WKi/.L; printf(#\n$d&'a); } printf(" \n decimal Numer is"$d\n"'a); !etche(); 0 Nrie a c program o e#aluae !e follo$ing series 0Essume suiable #alues for %0 D=%-%;7;[+%-7-[-%?7?[+ZZ%n7n[ /include<sdio0!> /include<conio0!> /include<ma!0!> #oid main() & in i1n1%1c=;1f=11l; floa sum; clrscr(); prinf(3ener !e #alue of %5n 6n3); scanf(3)d)d315%15n); sum=% for (i=;;i<=n;i+=*) & f=1; if (c)*[=0) { for (l=1;l<=i;l++) f=fTl; sum=sum-po$(%1i)7f; } 4lse { for (l=1;l<=i;l++) f=fTl; sum=sum+po$(%1i)7f; } '++ } prinf(36n sum of !e series=)-0<f6n31sum); gec!(); } Nrie a c program o e#aluae !e follo$ing series 0Essume suiable #alues for %0 D=%+%*7*[+%<7<[+%>7>[+ZZ%n7n[ /include<sdio0!> /include<conio0!> /include<ma!0!> #oid main() & in f=11l1i1%1y; floa sum; clrscr(); prinf(3ener !e #alue of %5y 6n3); scanf(3)d)d315%15y); sum=% for (i=*;i<=y;i+=*) & f=1; for (l=1;l<=i;l++) f=fTl; sum=sum+po$(%1i)7f; } prinf(36n sum of !e series=)-0<f6n31sum); gec!(); } ME=B:U MFC=:PC:'E=:,8 /include<sdio0!> /include<conio0!> #oid main() & in aW*XW*X1bW*XW*X1cW*XW*X1i121"; clrscr(); prinf(36n6n ener !e elemen of firs mari%6n6n3); for(i=0;i<*;i++) for(2=0;2<*;2++) & prinf(36na)d)d(31i12); scanf(3)d315aWiXW2X); } prinf(36n6n ener !e elemen of second mari% 6n6n3); for(i=0;i<*;i++) for(2=0;2<*;2++) & prinf(36nb)d)d(31i12); scanf(3)d315bWiXW2X); } prinf(36n6nmuliplicaion of mari% $ill be 6n6n3); for(i=0;i<*;i++) & for(2=0;2<*;2++) & cWiXW2X=0; for("=0;"<*;"++) & cWiXW2X=cWiXW2X+aWiXW"XTbW"XW2X; } prinf(3)d631cWiXW2X); } prinf(36n3); } gec!(); }