Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Program CS

The document contains 3 programming problems: 1) A program that generates the output 5, 10, 9 by initializing a variable to 5, doubling it, and subtracting 1. 2) A program that takes user input for a circle radius and calculates the area by importing pi and using the radius in the area formula. 3) A program that takes a character as input and prints whether it is an uppercase letter, lowercase letter, digit, or special character based on its ASCII value.

Uploaded by

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

Program CS

The document contains 3 programming problems: 1) A program that generates the output 5, 10, 9 by initializing a variable to 5, doubling it, and subtracting 1. 2) A program that takes user input for a circle radius and calculates the area by importing pi and using the radius in the area formula. 3) A program that takes a character as input and prints whether it is an uppercase letter, lowercase letter, digit, or special character based on its ASCII value.

Uploaded by

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

1) Write a program that generates output =

5,10,9.

-> a = 5
print(a)
a=a*2
print(a)
a=a-1
print(a)

OUTPUT
5
10
9
2) Write a program that accepts the radius of
circle and displays area of circle .
-> from math import pi
r = float(input ("Input the radius of the circle : "))
print ("The area of the circle with radius " + str(r) + "
is: " + str(pi * r**2))

Output :
Input the radius of the circle : 1.1
The area of the circle with radius 1.1 is:
3.8013271108436504

Flowchart :
3) Write program to find out print whether a
given character is an upper case or lower case
or digit or any other character .
-> ch=(input("enter a character"))
if(ch>='A' and ch<='Z'):
print("The Given Character is an Uppercase
Alphabet")
elif(ch>='a' and ch<='z'):
print("The Given Character is a Lowercase
Alphabet")
elif(ch>='0' and ch<='9'):
print("The Given Character is a digit")
else:
print("Given Character special character")

Output :
enter a character : 9
The Given Character is a digit

You might also like