Question:- Any Year Is input through the keyboard,wrtie a pgm to determine whether the year is leap year or not. Use Logical Operators. && and || ....
Now i have solved this problem using if-else , and using conditional opertor such as ? , : . See the pgm below.
if-else USED here !!!
Code:
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <stdio.h>
main()
{
int y;
printf("Enter The Year:");
scanf("%d",&y);
clrscr();
if(y%4==0)
printf("This is leap Year");
else
printf("Not a Leap Year");
getch();
}
Conditional operators used here!!
Code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
main()
{
int y;
printf("Enter The Year");
scanf("%d",&y);
(y%4==0 ? printf("Leap Year") : printf("Not A Leap Year"));
getch();
}
Now i m stuck in the same pgm where it asked to use logical oeperators....
see my programem below
Code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
main()
{
int y;
printf(" Input the desired year");
scanf("%d",&y);
if((y%4==0)||(y%4!=0)
printf("Leap Yr
I m stuck here...... i do not know..how can i use logical oeprators as there is only one condition that is " IF THE YEAR IS DIVIDED BY 4 THEN IT IS LEAP YEAR" so how can we use logical operators?????
Please help