Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

To be written for C++ Write a program that replies either Leap Year or Not a Lea

ID: 3791573 • Letter: T

Question


To be written for C++ Write a program that replies either Leap Year or Not a Leap Year, given a year. It is a leap year if the year is divisible by 4 but not by 100 (for example. 1796 is a leap year because it is divisible by 4 but not by 100). A year that is divisible by both 4 and 100 is a leap year if it also divisible by 400 (for example. 2000 is a leap year, but 1800 is not A perfect number is a positive integer that is equal to the sum of its proper divisors. A proper divisor is a positive integer other than the number itself that divides the number evenly (i.e., no remainder) For example. 6 is a perfect number because the sum of its proper divisors 1. 2. and 3 is equal to 6. Eight is not a perfect number because 1 + 2 + 4 notequalto 8. Write a program that accepts a positive integer and determines whether the number is perfect Also display all proper divisors of the number. Try a number between 20 and 30 and another number between 490 and 500. Write a program that displays all integers between low and high that are the sum of the cube of their digits. In other words, find all numbers xyz such that xyz = x^3 + y^3 + z^3 for example 153 = 1^3 + 5^3 + 3^3. Try 100 for low and 1000 for high

Explanation / Answer

#include <iostream>

using namespace std;

int main()
{
    //declare variables
    int no;
    //prompt user to enter number
   cout << "Enter a number: ";
   cin>>no;
   //check of it's leap year and print appr msg
   if((no%4==0 && no%100!=0)|| (no%4==0 && no%100==0&&no%400==0))
   cout<<"Leap Year";
   else
   cout<<"Not a Leap Year";
   return 0;
}

Sample Output:

Enter a number: 2000                                                                                                                                                                               

Leap Year

Please raise separate questions for each question

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote