0% found this document useful (0 votes)
55 views4 pages

Assignment-ASSIGNMENT dt-2021-01-30 04-28-53

This document provides programming assignments for a computer science course. It includes flowchart and C++ program assignments. The flowchart assignments involve sorting numbers, calculating averages, and swapping variable values. The C++ program assignments involve checking even/odd numbers, finding largest numbers, calculating years/months/days from days input, guessing a random number, checking palindromes, finding prime numbers between 1-100, and counting digits in a number. Loops are also to be used to print patterns.

Uploaded by

heaven leta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views4 pages

Assignment-ASSIGNMENT dt-2021-01-30 04-28-53

This document provides programming assignments for a computer science course. It includes flowchart and C++ program assignments. The flowchart assignments involve sorting numbers, calculating averages, and swapping variable values. The C++ program assignments involve checking even/odd numbers, finding largest numbers, calculating years/months/days from days input, guessing a random number, checking palindromes, finding prime numbers between 1-100, and counting digits in a number. Loops are also to be used to print patterns.

Uploaded by

heaven leta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

INFOLINK COLLEGE

DEPARTMENT OF COMPUTER SCIENCE

Develop a flowchart for each of the following questions. 1 point each


1. Receive 3 numbers and display them in ascending order from smallest to largest
2. Find the average of two numbers given by the user.
3. Swap the contents of two variables using a third variable.
4. Swap the content of two variables without using a third variable.
5. Read 10 integers from the keyboard in the range 0 - 100, and count how many of them are
larger than 50, and display this result.
6. Take an integer from the user and display the factorial of that number
Write a C++ program for each of the following questions
1. Write a program to check whether the given number is even or odd (using ? : ternary
operator ) (1 point)
2. Write a program which input three numbers and display the largest number using ternary
operator. (1 point)
3. Write a program which accepts days as integer and display total number of years, months
and days in it.(1.5 point)
Output
Enter no. of days: 796
Years: 2
Months: 2
Days: 6
4. Write a program that calculates a random number 1 through 100. The program then asks
the user to guess the number.
If the user guesses too high or too low then the program should output "too high" or "too
low" accordingly.
The program must let the user continue to guess until the user correctly guesses the
number.(2 point)
5. A palindrome is a word, number, phrase, or other sequence of characters which reads the
same backward as forward, such as madam, racecar, 9119, 81018, 101,…. Write a program
to check whether a number is palindrome or not. (1.5 point)
6. A prime number is an integer greater than one and divisible only by itself and one. The first
seven prime numbers are 2, 3, 5, 7, 11, 13, and 17. Write a program that displays all the
prime numbers between 1 and 100. (0.5 point)
7. Write a C++ program that counts the number of digits in an integer number. For example;
23498 has five digits. (0.5 point)
8. Write a program to print the following using loop.(This question is invalid if loop is not
used).(1 point each)
a.

b.

c.
d.

e.
f.

You might also like