# Tutor profile: Muhsin N.

## Questions

### Subject: Python Programming

Write a simple program that add two binary numbers

#The main function adds two binary numbers def add_binary_nums(x,y): max_len = max(len(x), len(y)) x = x.zfill(max_len) y = y.zfill(max_len) result = '' carry = 0 for i in range(max_len-1, -1, -1): r = carry r += 1 if x[i] == '1' else 0 r += 1 if y[i] == '1' else 0 result = ('1' if r % 2 == 1 else '0') + result carry = 0 if r < 2 else 1 if carry !=0 : result = '1' + result return result.zfill(max_len) #validating the program print(add_binary_nums('11', '1')) print(add_binary_nums('10', '10')) print(add_binary_nums('111', '111')) print(add_binary_nums('1111111', '1'))

### Subject: C++ Programming

Develop a single C++ program that take inputs from the user and find the area of Circle and Trapezoid and display it.

#include <iostream> using namespace std; float areatra(float a, float b, int h) //function calculating area of trapezoid { float area; area=.5*(a+b)*h*10.764; return area; } void display(float ar) //for display the area of trapezoid { cout<<"\nArea of the trapezium ="<<ar<<" sq. feets"; } float input() //for taking inputs from user { float r; cout<<"\n enter the radius of the circle:\n"; cin>>r; return r; } float areacir(float r) //function calculating area of circle { float area; area=3.147*r*r; return area; } int main() //main function takes inputs about the trapezoid and display the results { float a,b,r,arc,art; int h; cout<<"\n enter the values of the trapezium:a="; cin>>a; cout<<"\nb="; cin>>b; cout<<"\n h="; cin>>h; art=areatra(a,b,h); r=input(); arc=areacir(r); display(art); cout<<"\nArea of the circle ="<<arc<<"sq. meters"; }

### Subject: Algebra

An equation is given below : $$ \frac{24x^2 + 25x-47}{ax -2} = -8x -3 - \frac{53}{ax -2}$$. For what values of a, this equation is true ? Given 'a' is a constant and $$ x \neq \frac{2}{a}$$

The problem can be solved easily by multiply each side of the given equation by $$ax-2$$ (so that you can get rid of the fraction) . When you multiply each side by $$ax-2$$ you will get: $$ 24x^2 +25x -47 = (-8x-3)(ax-2)-53$$ Now you should multiply $$(-8x-3) and (ax-2)$$, then you will get : $$24x^2 +25x-47 = -8ax^2-3ax+16x+6-53$$ Now reduce on right side of the equation $$24x^2+25x-47=-8ax^2-3ax-47$$ Since the coefficients of the $$x^2$$ -term have to be equal on both sides of the equation, $$-8a = 24$$, or $$a=-3$$. So the answer is $$ a = -3 $$

## Contact tutor

needs and Muhsin will reply soon.