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

Program Development Notes With Code

Uploaded by

shubhamvanve777
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Program Development Notes With Code

Uploaded by

shubhamvanve777
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Program Development Notes with C++ Code

1) Select the correct alternative and rewrite the following:

1. A diamond box is used to indicate in flow charts:

- c) decision

2. Writing the program task in simple sequence and in simple English is known as:

- a) algorithm

3. Arranging the items in a list in descending or ascending order is called:

- b) sorting

4. Pictorial representation of a program:

- a) flowchart

5. The number of comparisons in linear search are:

- b) greater than binary search

6. ___ is midway between an algorithm and a program:

- b) pseudocode

---

2) What are the steps involved in program development?


---

3) Flowchart Symbols

---

4) C++ Code for Algorithms:

a) To find the minimum number among given 3 numbers:

#include<iostream>

using namespace std;

int main() {

int A, B, C;

cout << "Enter three numbers: ";

cin >> A >> B >> C;

if (A < B && A < C)

cout << "Minimum number is: " << A;

else if (B < A && B < C)

cout << "Minimum number is: " << B;

else

cout << "Minimum number is: " << C;

return 0;
}

---

b) To check whether the number is odd or even:

#include<iostream>

using namespace std;

int main() {

int N;

cout << "Enter a number: ";

cin >> N;

if (N % 2 == 0)

cout << N << " is even.";

else

cout << N << " is odd.";

return 0;

---

c) To calculate the sum of all odd numbers between 1 and 100:


#include<iostream>

using namespace std;

int main() {

int sum = 0;

for (int i = 1; i <= 100; i++) {

if (i % 2 != 0) {

sum += i;

cout << "The sum of odd numbers between 1 and 100 is: " << sum;

return 0;

You might also like