Computer Science, asked by qshamim938077652802, 3 months ago

write five python program​

Answers

Answered by harshvirsing55
0

\small\blue{\mid{\underline{\overline{\tt Answer :-}}\mid}}

#1

message=input('Enter your welcome message : ')

print(message)        

#2

a=int(input('Enter your 1st no. ='))

b=int(input('Enter your 2nd no. ='))

if (a > b) :

 max = a

 min = b

 print("Largest no. is",max,"\nsmallest no. is" ,min)

elif (a < b) :

   max = b

   min = a

   print("Largest no. is",max,"\nsmallest no. is" ,min)

else:

   print("Both no.s are equal")

#3

a=int(input('Enter your 1st no. ='))

b=int(input('Enter your 2nd no. ='))

c=int(input('Enter your 3rd no. ='))

#for largest no.

if (a > b) and (a > c):

   max = a

elif (b > a) and (b > c):

   max = b

else:

   max = c

   #For smallest no.

if (a < b) and (a < c):

   min = a

elif (b < a) and (b < c):

   min = b

else:

   min = c  

print("Largest no. is",max,"\nsmallest no. is" ,min)

#4

n=int(input("How many terms?(enter 2+ value ) :"))    #Fabonacci series

first=0

second=1

print("\nFabonacci series is :")

print(first,",",second,end=",")

for i in range(2,n):

   next = first + second

   print(next,end=",")

   first=second

   second=next

#5

n=int(input("Enter your number :"))

if n>1:

   for i in range (2,n):

       if n%i==0:

           print(n,"is a composite number.")

           break

   else:

       print(n,"is a prime number.")

else:

   print(n,"is a composite number.")

Answered by harsh5599
0

Programs:

1. Hello World Program

  1. print("Hello, World!")

2. Maximum Number Finding Program

  1. num1 = int(input("Enter First Number: "))
  2. num2 = int(input("Enter Second Number: "))
  3. num3 = int(input("Enter Third Number: "))
  4. print(max(num1, num2, num3))

3. Decimal To Binary Converting Program

  1. num = int(input("Enter Decimal Number: "))
  2. print(f"Binary Number: {bin(num)}")

4. Say Hello Program

  1. name = input("Enter Your Name: ")
  2. print(f"Hello, {name}!")

https://assets.grammarly.com/emoji/v1/1f917.svg

5. Square Root Finding Program

  1. import math
  2. num = int(input("Enter Number: "))
  3. print(f"Square Root Of {num}: {math.sqrt(num)}")

HOPE IT HELPS YOU

Similar questions