C Write a program that replies either Leap Year or Not a Lea
Solution
\"1. Leap year or not\"
#include <iostream>
 using namespace std;
int main()
 {
 int year;
cout << \"Enter a year: \";
 cin >> year;
if (year % 4 == 0)
 {
 if (year % 100 == 0)
 {
 if (year % 400 == 0)
 cout << year << \" is a leap year.\";
 else
 cout << year << \" is not a leap year.\";
 }
 else
 cout << year << \" is a leap year.\";
 }
 else
 cout << year << \" is not a leap year.\";
return 0;
 }
\"2. Prime number or not\"
#include <iostream>
 #include <cctype>
 using namespace std;
int main(){
 int n,i=1,sum=0;
 cout << \"Enter a number: \";
 cin >> n;
 cout<<\" Divisors of number are : \";
 while(i<n){
 if(n%i==0)
 {
 cout<<i<< \" \";
 sum=sum+i;
 }
 i++;
 }
 
 if(sum==n)
 cout << endl<<n<<\" is a perfect number\ \";
 else
 cout << i << \" is not a perfect number\ \";
 system(\"pause\");
return 0;
 }
\"3. \"
 #include <iostream>
 #include <cctype>
 using namespace std;
int main(){
 int low,high,num,sum=0, check=0,cube=0;
 cout << \"Enter a lower limit: \";
 cin >> low;
 cout << \"Enter a higher limit : \";
 cin >> high;
 cout<<\" calculating.... \"<<endl;
   
 while(low<=high){
 num=low;
            while ( num > 0 ) {
            cube=0;
            //cout<<num<< \" \";
            sum = num % 10;
            cube += (sum * (sum*sum)) ; //calculating cube of each digit
            num /= 10;
            check+=cube;       //adding sum of cubes of digits
           
            }
           
            if (low==check) //checkng sum of cube of digits to number
 cout << low <<\" ==> sum is \"<< check<< \"==>\"<< low<<\" is equal to sum of cube of its digits\"<<endl;
   
    check=0;         
 low++;
        }
 return 0;
 }


