Page 318 - Artificial Intellegence_v2.0_Class_9
P. 318
if Amount>10000:
if gender=="F":
print("Amount after 15% Discount is: ",Amount-(0.15*Amount))
else:
print("Amount after 10% Discount is ",Amount-(0.10*Amount))
else:
print("Sorry! no discount")
Output:
Enter billing Amount : 12000
Gender :M
Amount after 10% Discount is 10800.0
Program 8: To input a number and check whether it is multiple of 5 or not. This check is valid only for
positive numbers.
Algorithm Flowchart
Start
START
Input Num
if Num is greater than zero then Input Num
if Num is divisible by 5 then
Display "It is multiple of 5"
Is No Display
Otherwise Num > 0? "Invalid No"
Display "Not divisible by 5"
Yes
Otherwise
Display "Sorry! Invalid Number" Is No Display
Stop Num %5=0? "Not Multiple"
Source Code:
Yes
Num=int(input("Enter a number :"))
Display
"Multiple of 5"
if Num>0:
if Num%5==0:
print (Num," is multiple of 5%) STOP
else:
print(Num," is not multiple of 5%)
else:
print("Sorry! Invalid Number")
Output:
Enter a number : 34
34 is not multiple of 5
316 Touchpad Artificial Intelligence (Ver. 2.0)-IX

