PDF Google Drive Downloader v1.1


Báo lỗi sự cố

Nội dung text Assignment 1


Write a program that checks if a given year is a leap year. For example, the year 2020 is a leap year but 2021 is not. Hint: A year is a leap year if it is divisible by four but not divisible by one hundred, or if it is divisible by four hundred. Task 6: Student Grade Calculator Write a program that takes marks as input from the user. The program should print the grade according to the marks range. For example, marks between ninety and one hundred should give grade A, marks between eighty and eighty nine should give grade B, and so on. Hint: Use else if conditions to check different ranges of marks. Task 7: Simple Calculator Write a program that asks the user to enter two numbers and an operator such as addition, subtraction, multiplication, or division. Perform the selected operation and display the result. Hint: Use the switch case statement. Task 8: Print Numbers from One to Ten Write a program that prints numbers from one to ten on the screen. Hint: Use a for loop. Task 9: Print Even Numbers up to N Write a program that takes a number N from the user and prints all even numbers from two up to N. Hint: Use a for loop and increase the counter by two each time. Task 10: Sum of First N Natural Numbers Write a program to calculate the sum of the first N natural numbers. For example, if the user enters five, the result should be fifteen. Hint: Use a loop to add numbers one by one. Task 11: Multiplication Table Write a program that asks the user for a number and then prints the multiplication table of that number up to ten. Hint: Use a for loop to multiply the number with one to ten. Task 12: Factorial of a Number

Write a program that prints the first N numbers in the Fibonacci series. The Fibonacci series starts with zero and one, and every next number is the sum of the previous two. For example, zero, one, one, two, three, five, eight. Hint: Use a loop with two variables to store the last two numbers. Task 20: Menu Driven Program Write a program that repeatedly shows a menu with options to add, subtract, multiply, divide, and exit. The user should choose an option, the program performs the operation, and the menu should appear again until the user selects exit. Hint: Use a do while loop to keep displaying the menu until the user selects the exit option.

Tài liệu liên quan

x
Báo cáo lỗi download
Nội dung báo cáo



Chất lượng file Download bị lỗi:
Họ tên:
Email:
Bình luận
Trong quá trình tải gặp lỗi, sự cố,.. hoặc có thắc mắc gì vui lòng để lại bình luận dưới đây. Xin cảm ơn.