Sunday, March 19, 2023

"find a year is leap year or not ,using if else statement " in c .

  //find a year is leap year or not, using if else statement

 # include <stdio.h>
 int main (){
    int y;
    printf ("enter the year  :");
    scanf ("%i",&y);
    if (y%4==0){
        if (y%100==0){
            if (y%400==0)
                printf ("%i is a leap year ",y);
                else
                 printf ("%i is  not a leap year ",y);
        }
           
            else printf ("%i is a leap year ",y);
        }
        else printf ("%i is  not a leap year ",y);

        return 0;
    }
 
 

No comments:

Post a Comment

print a multiplication table of any integer taking from user

 // print a multiplication table of any integer taking from user  #include "stdio.h" int main () { int n,mul,i; printf ("...