0% found this document useful (0 votes)
33 views

Sample Documentation

The document describes a C++ program that adds two numbers. It takes in two integer inputs, adds them together, and displays the sum. The program was created by Iris Mallari Yumul on June 25, 2009 to demonstrate accepting two numbers as input, performing addition, and outputting the result.

Uploaded by

api-19794302
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Sample Documentation

The document describes a C++ program that adds two numbers. It takes in two integer inputs, adds them together, and displays the sum. The program was created by Iris Mallari Yumul on June 25, 2009 to demonstrate accepting two numbers as input, performing addition, and outputting the result.

Uploaded by

api-19794302
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Details:

Name: Iris Mallari Yumul


Name of Program: Adding Two Numbers
File Name: Adding2Numbers.cpp
Date Created: June 25, 2009

Objective:

To create a program that would display the sum of two numbers.

Specifics:

 Accept two numbers as integers.


 Add the two numbers together.
 Display the final answer.

Inputs, Outputs, and Variables Names:

Inputs:
1. Number 1 – n1
2. Number 2 – n2

Outputs:
1. Sum – sum

Algorithm:

Begin

Define n1,
n2, and sum
as int

Accept n2 Accept n1

sum = n1 + n2 Display sum. End

6LOGFOR – Logic Formulation 1


Ms. Iris Mallari Yumul, HAU 1st Semester 2009 - 2010
Source Code:

/* Name of Programmer: Iris Mallari Yumul


Name of Program: Adding Two Numbers
File Name: Adding2Numbers.cpp
Date Created: June 25, 2009 */

#include<stdio.h>
#include<conio.h>

main()
{
int n1, n2, sum; //Declares the variables

printf(“Enter number 1: ");


scanf("%d",&n1); //Accepts the first number
printf("\nEnter number 2: ");
scanf("%d",&n2); //Accepts the second number

sum = n1 + n2; //Add the two numbers

printf("%d is the sum", sum); //Displays the sum

getch();
}

Sample Output:

6LOGFOR – Logic Formulation 2


Ms. Iris Mallari Yumul, HAU 1st Semester 2009 - 2010

You might also like