You are on page 1of 13

Practice (Functions)

Quick questions on functions


1) Sum of first n natural numbers
2) Check pythagorian triplet
3) Conversions
a) Binary to decimal
b) Octal to decimal
c) Hexadecimal to decimal
d) Decimal to binary
e) Decimal to octal
f) Decimal to hexadecimal
4) Add two binary numbers

Sum of first n natural numbers

Check pythagorian triplet


Conversions

Binary to decimal

Octal to decimal
Hexadecimal to decimal
Decimal to binary

Decimal to octal
Decimal to hexadecimal
Add two binary numbers
Codes

1. Sum of first n natural numbers

2. Check pythagorean triplet


Conversions

a) Binary to Decimal

b) Octal to decimal
c) Hexadecimal to decimals

d) Decimal to binary
e) Decimal to octal

f) Decimal to hexadecimal
4. Add two binary numbers

You might also like