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

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!"
主站蜘蛛池模板: 宜都市| 沙雅县| 北宁市| 连平县| 红安县| 修武县| 开鲁县| 酒泉市| 获嘉县| 海盐县| 衡水市| 巴东县| 历史| 纳雍县| 怀远县| 堆龙德庆县| 云龙县| 灯塔市| 舒城县| 通化县| 株洲县| 稻城县| 宁海县| 年辖:市辖区| 蒙山县| 河北省| 阜新市| 西丰县| 海门市| 崇州市| 正宁县| 江口县| 马关县| 西藏| 渝北区| 金沙县| 西林县| 白水县| 鹿泉市| 罗甸县| 崇阳县|