You are on page 1of 4

C&DS

DESD August 2013

Pre Assignment: Work with known c programs in linux environment using gcc compiler Some Hints to work on:!ollow mo"ern#$S%& stan"ar"s like C'' while co"ing ( no more ol" stan"ar"s like ANSI/C89 no conio.h please( so no more clrscr, getch #instea" )ou can use unix*linux comman" clear or ctrl+ to clear the screen( an" no pro+lem o, hol"ing output screen with getch& return t)pe o, main must +e int a"" ret!rn " at the en" o, main -est o, the changes across the stan"ar"s can +e "iscusse" in ,urther sessions & assignments A simple program .inclu"e/st"io h0 int main#& 1 print,#23ello Worl"4n5&6 return 06 7 3ow to +uil" an" run89 1& 2& 3& <& =& >& ?& %pen a terminal an" switch to "esire" "irector) vi hello c 3it i to enter $:SE-; mo"e Enter a+ove co"e*e"it existing co"e 3it #sc ke) ( ,ollowe" +) :w$ gcc hello c 9o hello $, an) errors go to step2 *hello $, an) runtime errors or o*p mismatch go to step2 #or& >th an" ?th steps can +e( i e in a+sence o, 9o option "e,ault executa+le name is a out >& ?& gcc hello c *a out

CDAC AC;S( @une

C&DS

DESD August 2013

Aou ma) tr) the ,ollowing pro+lems with "i,,erent possi+le alternatives wherever possi+le( spot out the optimal logic among the alternatives i, an) Note:- Aou ma) skip an) part o, this assignment i, )ou are con,i"ent enough %asics:Area o, the circle Swapping o, two num+ers -eversing 3 "igit no

Control Str!ct!res:a&Sim'le i(-else Biggest o, two num+ers Even or o"" num+ers A+solute value o, a num+er Civen character is vowel or not Civen )ear is leap or not )&Neste* i(-else Biggest o, 3(< num+ers Dua"rant o, a point #D1(D2(D3(D< etc& Eeap )ear or not c&#lse i( la**er Biggest o, 3(< num+ers Dua"rant o, a point #D1(D2(D3(D<(on axis( origin etc& Eeap )ear or not Da) o, the week Cra"e o, the stu"ent +ase" on marks in n su+Fects Choice +ase" arithmetic #19a""(29su+(39mul(<9"iv etc& Electricit) +ill or $ncome tax pro+lem -oots o, a Gua"ratic eGuation *& switch Da) o, the week Choice +ase" arithmetic #19a""(29su+(39mul(<9"iv etc& CDAC AC;S( @une 2

C&DS Civen character is vowel or not e& oo's @rinting no series Sum & Avg o, n num+ers Hultiplication +) repetitive a""ition Division +) repetitive su+traction I ,in" Guotient an" remain"er -eversing no ( palin"rome or not( sum o, "igits in a given num+er Evaluation o, a 'ower m !actorial o, given no Evaluation o, n c r #use onl) 2 loops& C C D o, two no s#tr) with while*,or an" "o9while& C C D with repetetive su+traction E C H o, two no s#without ,in"ing C C D& !i+onacci series Civen no is armstrong or not Civen no is per,ect no or not Civen no is prime no or not Evaluation o, series #:ote89 )ou shou"nJt calculate xk in ever) iteration& 1KxKx2**2LKx3*3LK (& Neste* loo's -ecursive sum o, "igits in a num+er #eg89 '?M= NN0 'K?KMK= NN0 2' NN0 2K' NN0 11 NN0 1K1 NN0 2 @rinting pascal trianle Eist o, prime num+ers Ceneration o, num+er ta+les( triangles !ew examples are89 123 < 2<> M 3 > ' 12 < M 12 1> CDAC AC;S( @une 1 12 123 123< 1 21 321 <321 a a+ a+c a+c" < <3 <32 <321 Kxn*nL

DESD August 2013

C&DS

DESD August 2013

<321 <32 <3 <

123 < 123 12 1

1 121 12321 123<321

1 23 <=> ? M ' 10

CDAC AC;S( @une

<

You might also like