engineering mathematics 3 solutions |
part 1
credit to Dr. Akhilesh Jain ( Asst. Professor, Department of Mathematics)
Get all engineering mathematics 3 solutions(m3) from the given link
please follow
Question : if three sides of a triangle are entered through the keyboard, write a program to check whether the triangle is valid or not. the triangle is valid if the sum of two sides is greater than the largest of three sides.
source code
#include <iostream>
#include<conio.h>
int greternum(int ,int,int);
int sumofsmaller(int ,int ,int,int );
using namespace std;
int main()
{
int a,b,c,grater,smaller;
cout<<"Enter 3 number : ";
cin>>a>>b>>c;
grater=greternum(a,b,c);
smaller=sumofsmaller(a,b,c,grater);
//cout<<grater <<endl<<smaller <<endl;
if (smaller > grater)
{
cout<<"it is valid triangle ";
}
else
{
cout<<"it is not valid triangle ";
}
getch();
return 0;
}
int sumofsmaller(int a, int b,int c,int grater)
{
if (a<grater && b<grater)
{
return a+b;
}
else if (a<grater && c<grater )
{
return a+c;
}
else
{
return c+b;
}
}
int greternum(int num1,int num2,int num3)
{
if (num1<num2 && num3<num2)
{
return num2;
}
else if (num1<num3 && num2<num3 )
{
return num3;
}
else
{
return num1;
}
}
covid19 updater is a desktop app used to upload live coronavirus data on your Facebook page post. by just click on the start button.
Screenshots
download exe file
covid19 updater
Question :
if lengths of three sides of the triangle are input through the keyboard ,write a program to find the area of the triangle .
SCREENSHOTS
SOURCE CODE
#include <iostream>
#include<conio.h>
#include <math.h>
using namespace std;
int main()
{
int a,b,c ;
float area;
cout <<"Enter 3 sides of triangle : \n";
cin>>a>>b>>c;
area=sqrt(pow(((4*a*a*b*b)-((a*a)+(b*b)-(c*c))),2))/4;
cout<<area;
}
Question: If a five-digit number is input through the keyboard. Write a program to reverse a number.
solution :
Screenshot
source code
#include <iostream>
#include<conio.h>
using namespace std ;
int main()
{
int n;
int rev[6],revn=0;
cout<<"Enter a 5 digit number : ";
cin >>n;
for(int i=1; i<6; i++)
{
rev[i]=n%10;
n=n/10;
}
for(int i=1; i<6; i++)
{
cout<<rev[i];
}
}
QN 1. if a five-digit number is input through the keyboard ,write a program to calculate the sum of digits. (hint: Use the modules operator '%').
solution:
Screenshot
SOURCE CODE
#include <iostream>
#include<conio.h>
using namespace std ;
int main()
{
int n;
int sum =0;
cout<<"Enter a 5 digit number : ";
cin >>n;
for(int i ; i<6; i++)
{
sum = sum + n%10;
n=n/10;
}
cout<<sum;
}
In this blog you you can learn how to how to make decimal to binary converter program.
process of conversion :-
source code :
#decimal to binary converter
def dec_bin(dec): #define function
binnum=[0]*dec #list created
i=0 #assign i for count
while dec > 0: #while loop
binnum[i] = dec%2 #logic part 1
dec = dec//2 #logic part 2
i += 1 #increase by 1
for j in range (i-1,-1,-1): #for loop for reverse the binary number to p
print(binnum[j],end="") #printing binary number
dec = int(input("enter the decimal number : ")) #take input through user
dec_bin(dec) #function calling..
Question :
Find sum of all digit of number :-
this problem is solved by two method :-
1st is without recursion method and
2nd is using recursion method
let's start ,
Without recursion method
step 1 :
make a function with name sumofDigit(num) : and pass the argument which is entered from the user
def sumofDigit(num):
step 2 :
we use while loop here for checking if num is grater then 0 is show in the code below :-
add=0
while num>0:
if the condition is True then we move to the next step
step 3 :
this step is totally on logic as shown below : -
add = add + num%10
num = num//10
print(add) #to print the result
step 4 :
in the step you come out from the function and call the function as shown below : -
num=int (input("enter the number : ")); #take input through user
sumofDigit(num) #function call
COMPLETE SOURCE CODE
1st method of without using recursion
#sum of 4 digit number without recursion
num=int (input("Enter the number : "))
add=0
while num>0:
add=add+num%10
num=num//10
print(add)
2nd Method using recursion
#sum of 4 digit using recurssion
def sdig(num):
if num==0:
return 0
return ((num%10) + sdig(num//10))
num=int (input("Enter the number : "))
print(f"sum of digit of {num} is {sdig(num)}")
Question :
write a function reverse_number () to return the reverse of the number entered.
Example :
Reverse_number(1234) display 4321
Source code :
def reverse_number (num):
add=""
while (num > 0):
n=num%10 # logic
num=num//10
add=str(add)+str(n)
print(add)
num = int (input("Enter the number : "))
reverse_number(num)
Instabot
In this session we learn how to upload picture using python library called instabot .
How to instabot on your pc .
step 1:
go to the START, search cmd then, press enter key
after that your command prompt is open as show in the given picture : -
step 2:
you have to type pip install instbot and press ENTER on the command prompt as shown in picture below : -
AFTER doing this all steps then your instabot is successfully installed on your pc . as shown in picture below : -
now go to the OPEN your IDLE and write the code below : -
Source Code
from instabot import Bot
bot=Bot()
bot.login(username= "yout username ",password="your password")
bot.upload_photo("C:/Users/ajay pandit/Desktop/UtubDownloader 18-03-2021 08_17_23.png" ,caption=" write caption here " )
Mini robot using python
In this project we use four library
1. SpeechRecognition library
2. wikipedia libirary
3. gTTS library
4. pyaudio library
5. playsound library
source code
import speech_recognition as sr
import wikipedia
from gtts import gTTS
from playsound import playsound
#recording part
for i in range(1,10):
rec = sr.Recognizer()
with sr.Microphone() as source:
print("clearing backgroung noise.....")
rec.adjust_for_ambient_noise(source, duration=1)
print("weating for your message : ")
recaudio = rec.listen(source)
print("recording done... !")
try:
# recording to text converting part
print("printing the message ....")
text = rec.recognize_google(recaudio, language='hindi-IN')
print(f"your messange is : {format(text)}")
# listining part
topic = (f"searching for ---> {format(text)}")
summ = wikipedia.summary(topic)
print(summ)
tts = gTTS(summ)
tts.save(f"wiki{format(text)}.mp3")
# reading audio file
print("reading.....")
playsound(f"wiki{format(text)}.mp3")
except:
print("keyword is not found !!")
source code
#include<iostream>
#include<conio.h>
#include<windows.h>
using namespace std;
class time
{
public:
int h,m,s;
public:
void gettime()
{
int e=0;
while (e==0)
{
cout<<"hour : ";
cin>>h;
cout<<"minute : ";
cin>>m;
cout<<"secound : ";
cin>>s;
if (h<24 && m<60 && s<60)
{
e++;
}
else
{
system ("cls");
}
}
}
void conditions()
{
system("cls");
cout<<h<<":"<<m<<":"<<s<<endl;
Sleep(1000);
s++;
}
void secound()
{
if (s>59)
{
s=0;
m++;
}
}
void minute ()
{
if (m>59)
{
m=0;
h++;
}
}
void hour ()
{
if (h>24)
{
h=0;
}
}
};
int main()
{
int a=0;
time obj;
obj.gettime();
while(a==0)
{
obj.conditions();
obj.secound();
obj.minute();
obj.hour();
}
}
Strong number is a special number whose sum of factorial of digits is equal to the original number. For example: 145 is strong number. Since, 1! + 4!
IDLE view :
source code :
#strong number 145
def fact(n): #calculating factorial
if (n>0):
return (n*fact(n-1))
else:
return (1)
#strong number code
add=0
num=input("enter the number : ")
l=(len(num))
for i in range(0,l):
add=add+fact(int(num[i]))
if int(num)==add:
print(f"{num} is strong number ")
else:
print (f"{num} is not strong number ")
Positive integer greater than 1 which has no other factors except 1 and the number itself is called a prime number. 2, 3, 5, 7 etc. are prime numbers as they do not have any other factors. But 6 is not prime (it is composite) since, 2 x 3 = 6
.
num=int(input("enter the numbr : "))
for i in range (2,num):
if (num%i != 0 ):
print(f"{num} is a prime number ")
break
else:
print (f"{num} is not prime number ")
break;
video :
perfect number program using python
Perfect number, a positive integer that is equal to the sum of its proper divisors. The smallest perfect number is 6, which is the sum of 1, 2, and 3. Other perfect numbers are 28, 496, and 8,128.
source code
# enter number is perfect or not
num = int (input("enter the number : "))
add=0
for i in range (1,num):
if(num%i==0):
add=add+i
if num==add:
print(f"{num} is profect number ")
else:
print (f"{num} is not profect number ")
kivy project
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
class MyGradeLayout(GridLayout):
def __init__(self, **kwargs):
super(MyGradeLayout,self).__init__(**kwargs)
self.cols=2
#name:
self.add_widget(Label(text='name : ',font_size=30))
self.name=TextInput(multiline=False)
self.add_widget(self.name)
#movies:
self.add_widget(Label(text='movies : ',font_size=30))
self.movies = TextInput(multiline=False)
self.add_widget(self.movies)
#ratig:
self.add_widget(Label(text='rating : ',font_size=30))
self.rating = TextInput(multiline=False)
self.add_widget(self.rating)
#button
self.submit=Button(text="submit",font_size=32)
self.submit.bind(on_press = self.press)
self.add_widget(self.submit)
def press(self,instance):
name = self.name.text
movies = self.movies.text
rating = self.rating.text
#print(f"hello {name}, you love {movies}, because the rating of this moves is {rating}")
self.add_widget(Label(text=f"Hello {name},\n you love '{movies}' movies,\n because the rating of this moves is {rating}"))
#after press the button clear input boxes
self.name.text=""
self.rating.text=""
self.movies.text=""
class MyApp(App):
def build(self):
return MyGradeLayout()
if __name__=='__main__':
MyApp().run()
from tkinter import *
from playsound import playsound
import os
root= Tk()
def play():
playsound("C:\\Users\\Hacking knowledge\\Desktop\\songs\\a (1).mp3")
def allsong1():
allsong=os.listdir("C:\\Users\\Hacking knowledge\\Desktop\\songs")
print("LIST OF SONGS ")
verticaltable="\n".join(allsong)
print (verticaltable)
def push():
pass
root.title("Aj player")
root.geometry("245x400")
f1=Frame(root,bg="yellow4",padx="7",borderwidth= "6")
f1.pack(side=LEFT,fill="y")
b1=Button(f1,text="all song",bg="yellow1",fg="gray",padx="10",pady="10",font="arial 10 bold",borderwidth="10",command=allsong1)
b1.pack(side=LEFT)
b2=Button(f1,text="stop",bg="yellow1",fg="gray",padx="10",pady="10",font="arial 10 bold",borderwidth="10")
b2.pack(side=LEFT)
b3=Button(f1,text="play",bg="yellow1",fg="gray",padx="10",pady="10",font="arial 10 bold",borderwidth="10",command=play)
b3.pack(side=LEFT)
root.mainloop()
from tkinter import *
obj=Tk()
def name():
print ("ajay pandit")
def profilepic():
root=Tk()
root.geometry("0x0")
root.title("ajay pandit")
photo=PhotoImage(file="4.png")
aj=Label(image=photo)
aj.pack()
root.mainloop()
def aboutus():
print('''\n\n
The computer science engineer
expert on programming(c,c++,java,python,html,css,sql)
certified ethical hacker''')
def contactus():
print('''\n\n
phonr no. : 0123456789
email : ajayoneness123@gmail.com
instagram.com/hacking_knowledge
www.codeajay.blogspot.com
fb.com/hackingknowledge''')
obj.geometry("500x900")
f1 =Frame(obj,bg="green",borderwidth=6,relief=RAISED)
f1.pack()
b1=Button(f1,text="contact us",font ="arial,20,bold",padx=10,pady=10,bg="gray",command=contactus)
b1.pack(side=RIGHT,anchor="nw")
b2=Button(f1,text="about us",font ="arial,10,bold",padx=10,pady=10,bg="gray",command=aboutus)
b2.pack(side=RIGHT,anchor="nw")
b3=Button(f1,text="profile pic",font ="arial,10,bold",padx=10,pady=10,bg="gray",command=profilepic)
b3.pack(side=RIGHT,anchor="nw")
b4=Button(f1,text="name",font ="arial,10,bold",padx=10,pady=10,bg="gray",command=name)
b4.pack(side=RIGHT,anchor="nw")
obj.mainloop()
from tkinter import *
import time
import playsound
#BORDER STYLE(relief)= SUNKEN, RAISED, GROOVE, RIDGE
for i in range(1,10):
root=Tk()
root.geometry("1000x1000")
f1=Frame(root)
f1.pack()
f2=Frame(root)
f2.pack()
lb=Label(f1,text=f'''It's 28th jan \nshivraj birthday!!!\nHAPPY BIRTHDAY TO YOU SHIVRAJ''',bg="gray",
fg="black",padx="40",pady="20",font="arial 30 bold", borderwidth=10,relief=RAISED)
lb.pack(anchor="ne",fill="x")
pic=PhotoImage(file="3.png")
lb=Label(f2,image=pic,bg="purple",
fg="black",padx="40",pady="20",font="arial 20 bold", borderwidth=10,relief=RAISED)
lb.pack(anchor="ne",fill="x")
root.mainloop()
time.sleep(0.4)
Find the cube of the range given Digits. Source Code r= int ( input ( "enter the range of digit : " )) def number_conter (n): ...