0% found this document useful (0 votes)
185 views1 page

Assignment 2b. Programming Fundamentals

The document outlines 6 programming assignments: 1) Write a program that allows a user to choose computing the sum or product of integers from 1 to a given number n. 2) Write a program to print the first 20 terms of the series 3n+2 that are not multiples of 4. 3) Write a program to convert a binary number to decimal. 4) Write a program to convert a decimal number to binary. 5) Write programs to find the integral and decimal parts of the square root of a given number. 6) Write a program to determine if a sequence of integers can be split into two strictly decreasing then increasing parts.

Uploaded by

chitranshpandey
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
185 views1 page

Assignment 2b. Programming Fundamentals

The document outlines 6 programming assignments: 1) Write a program that allows a user to choose computing the sum or product of integers from 1 to a given number n. 2) Write a program to print the first 20 terms of the series 3n+2 that are not multiples of 4. 3) Write a program to convert a binary number to decimal. 4) Write a program to convert a decimal number to binary. 5) Write programs to find the integral and decimal parts of the square root of a given number. 6) Write a program to determine if a sequence of integers can be split into two strictly decreasing then increasing parts.

Uploaded by

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

Assignment 2(b) Programming Fundamentals

1. Write a program that asks the user for a number n and gives
him the possibility to choose between computing the sum
and computing the product of 1,...,n.

2. Write a program to print first 20 terms of the series 3n+2 which


are not multiples of 4.

3. Given a binary number convert it into decimal.

4. Given a decimal convert it into binary.

5. Write a program to find square root of an input.

a. Just find the integral part


b. Find the square root with an accuracy of n decimal
points, n is provided by the user.

6. You are given S a sequence of n integers S = s1, s2, ..., sn.


Please, compute if it is possible to split S into two parts : s1, s2,
..., si and si+1, si+2, .., sn
(1 <= i < n) in such a way that the first part is strictly decreasing
while the second is strictly increasing one. First take n as input
and then take n more integers, output yes or no.

You might also like