Ticker

6/recent/ticker-posts

C program to find sum of two number

   


Program design is not a single step that follow SDLC(software development life cycle).
  • Identify problem.
  • Write Algorithm.
  • Prepare flowchart.
  • Design Program.(coding).
 Problem:-To find sum of two number.

Algorithm:-

After  problem  identification  write algorithm for the problem solution. No need any programming language in writing algorithm Using English language simply write the algorithm.

Step1:- Start

Step2:- Declare variable num1,num2 and Sum.

Step3:- Read num1 and num2.
            Sum=num1+num2.
           
Step4:- Display Sum.

Step5:-  Stop.


Flowchart:-
After algorithm flowchart is created. All logical error found more clearly in flowchart.Flowchart is graphical representation of problem solution logic. We  draw flowchart because graphic easy to understand.







Program:- 
After flowchart design then next task is write program using any programming language.Here use c language to write code. After program write compile the code using CTRL+F9  all syntax error found after compilation the code.Press CTRL+F5 to show the result. 
  

Code



Output



In code printf function is used to print the  meassage on screen. scanf is used to read input. Library stdio is used. Printf  and scanf  function of  stdio library. So program design follow  SDLC  no  single step task.









Post a Comment

0 Comments