Subscribe Us

How do you write an algorithm in C program ? - What is algorithm in C ? - example of algorithm in C

 


WHAT IS AN ALGORITHM?

ALGORITHM IS  A PROCESS TO SOLVE A PROBLEM STEP BY STEP. IT IS DEPENDS ON STATEMENTS. ANYONE CAN UNDERSTAND PROGRAMS IN ALGORITHMS.


LET’S  UNDERSTAND ALGORITHM BY  A PROBLEM, / ALGORITHM EXAMPLES

PROBLEM 1: FIND THE AREA OF A TRIANGLE USING AN ALGORITHM  IN C PROGRAMMING?
 

ANS: TO FIND THE AREA OF A TRIANGLE USE THIS ALGORITHM

STEP 1: START

STEP 2: TAKE TRIANGLE BASE AND HEIGHT

STEP 3 : AREA = ½ * BASE * HEIGHT

STEP 4: SHOW THE AREA

STEP 5: END


PROBLEM 2:  ADDITION OF THREE NUMBERS USING ALGORITHM IN C PROGRAMMING?

ANS: TO FIND THE ADDITION OF THREE NUMBERS USE THIS ALGORITHM

STEP 1: START

STEP 2: TAKE THREE NUMBERS A, B, C

STEP 3: ADD THREE NUMBERS A+B+C

STEP 4: SHOW THE RESULT

STEP 5: END

Post a Comment

0 Comments