Lab Assignment 1 ECSE104L solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (3 votes)

Ques1- Write a program to convert one number from one base to another base. User will give three input

  1. Number
  2. Input number base
  3. Output number base

 

Output of the program:-  converted number in the given base

Base range will be 2-20, after 9 start alphabet in uppercase

Example-

(234.56)8 = (010011100.101110)2

In this example user will give 234.56, 8, 2 as input and output will be 010011100.101110

Important- your program also check validity of input for example-

If someone inputted 129.43, 8, 4

Then 129.43 is not possible in base 8 maximum number can be 7 only in base 8. In such cases you will print “invalid input” as output.

 

Ques 2- write a program to add two number. Input for the program are two and their base output of the program will be addition in the given base.

Example-

(123)4 +(23)4 = (212)4

Input will be 123,  23,  4   (first number, second number, base)

Output- 212

Here also first you have to check validity of the input.