April 17, 2021

Area of triangle with given sides using c++

 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;

}

April 07, 2021

Reverse given 5 digit numbers using C++ programming

 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];

}

}

Sum of 5 digit number using c++

 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;

}



April 04, 2021

weather app using tkinter python

In this app, we use API to get the weather information. 
 we use free API in this project you can also buy.

screenshots of Weather app




SOURCE CODE 

#IMPORTS MODULE 
import tkinter as tk
import requests
import time
import os

#DEFINE FUNCTION TO GET WEATHER INFORMATION
def getweather(root):
    try:
        city=textfield.get()
        api="http://api.openweathermap.org/data/2.5/weather?q="+city+"&appid=d9db53c6ebe4a8110caa93993b1d48d5"
        json_data=requests.get(api).json()
        condition= json_data['weather'][0]['main']
        temp=int(json_data['main']['temp']-273.15)
        temp_min = int(json_data['main']['temp_min'] - 273.15)
        temp_max = int(json_data['main']['temp_max'] - 273.15)
        pressure = json_data['main']['pressure']
        humidity = json_data['main']['humidity']
        wind = json_data['wind']['speed']
        sunrise=time.strftime("%I:%M:%S", time.gmtime(json_data['sys']['sunrise']-19800))
        sunset = time.strftime("%I:%M:%S", time.gmtime(json_data['sys']['sunset'] - 19800))

        final_info = condition + "\n" + str(temp) + "℃"
        final_data = "\nMax Temperature : "+str(temp_max)+"\nMin Temperature : "+str(temp_min)+"\nPressure : "+str(pressure)+"\nHumidity : "+str(humidity)+"\nWind Speed : "+str(wind)+"\nSunRise : "+str(sunrise)+"\nSunSet : "+str(sunset)


        l1.config(text = final_info)
        l2.config(text = final_data)
    except:
        invalid="invalid city name OR there is no internet connection !! "
        i.config(text=invalid)

#GUI PART USING TKINTER
root = tk.Tk()
root.geometry("500x600")
root.title ("weather app")
f=("poppins",15,"bold")
t=("poppins",35,"bold")
col='gray22'
fcol='gray'


root.configure(background = col)    #backgroung color
l0=tk.Label(root,text='City/Place Name',font=t,bg= col,fg=fcol).pack()
l3=tk.Label(root ,text='powered by ajay',font='poppins 10 bold', bg = col,fg= fcol ).place(x='350',y='550')


textfield=tk.Entry(root,font=t,bg=col,fg=fcol)
textfield.pack(pady=20)
textfield.focus()
textfield.bind('<Return>',getweather)

i=tk.Label(root,bg=col,fg=fcol,font ='areal 10 bold')
i.pack()

l1=tk.Label(root,font = t,bg=col,fg=fcol)
l1.pack()
l2=tk.Label(root,font=f,bg=col,fg=fcol)
l2.pack()

# it creates a loop to view the GUI continues.
root.mainloop()


Project GIT link












find the cube of the range given digits. || codeAj

Find the cube of the range given Digits. Source Code r= int ( input ( "enter the range of digit : " )) def number_conter (n): ...