官术网_书友最值得收藏!

Exercises

  • Write a program to check if a number is odd or even (hint: find the modulus of the number by 2, and if the modulus is equal to 1, then the number is even; else the number is odd).
  • Take inputs of three variables (Name, Age, and Email) from a user. If the age is greater than 20, print all the variables. If the age is equal to or less than 20, print "Sorry! You are not allowed!".
  • Take an input of three integers and print the largest integer (hint: follow the previous example)
  • Take the input of the marks of a student (four subjects) and find his GPA (hint: take variables as float; use if conditions to find the GPA of a subject; then add all the GPAs, pide the total with the total number of subjects, and print the value).
  • Define the days of a week from 1 to 7. Take an input of the day number, and if the day number is odd, print "Have a lovely day;" if the day number is even, print "It is a lovely day!"
主站蜘蛛池模板: 常德市| 嘉义市| 双峰县| 西宁市| 石泉县| 丰顺县| 奈曼旗| 东乌珠穆沁旗| 正蓝旗| 岐山县| 嵊州市| 逊克县| 额敏县| 都安| 大冶市| 彰武县| 揭阳市| 略阳县| 长寿区| 桐城市| 连南| 宁晋县| 钦州市| 喀什市| 呈贡县| 佛冈县| 丰县| 清水河县| 溧阳市| 彝良县| 凤阳县| 如皋市| 太原市| 德化县| 卓资县| 乌恰县| 茶陵县| 蓬莱市| 邹城市| 习水县| 喜德县|