0% found this document useful (0 votes)
116 views3 pages

Computer Science HW 1

Uploaded by

aladdinvszafar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views3 pages

Computer Science HW 1

Uploaded by

aladdinvszafar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Computer Science

HW - 1

Program 1: Leap Year

Source Code:

Y = int(input('Enter the Year:'))

if(Y%4==0):
print('It is a leap year!')
else:
print('It is NOT a leap year!')

Output Screenshot:
Program 2: Quadratic Equations

Source Code:

A = float(input('Enter A:'))
B = float(input('Enter B:'))
C = float(input('Enter C:'))

D = B*B-4*A*C

if(D<0):
print('Roots are NOT Real - Imaginary')
elif(D==0):
print('Roots are Real and Equal')
else:
print('Roots are Real and Distinct')

print(D)

Output Screenshot:
Program 3: Sides of a Triangle

Source Code:

A = int(input('Enter first side:'))


B = int(input('Enter second side:'))
C = int(input('Enter third side:'))

if A == B == C:
print('It is an Equilateral Triangle.')
elif A == B or B == C or A == C:
print('It is an Isosceles Triangle')
elif A**2 == B**2 + C**2 or B**2 == A**2 + C**2 or C**2 ==
A**2 + B**2:
print('It is a Right Angled Triangle')
else:
print('It is a Scalene Triangle')

Output Screenshot:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy