#include
#include
void main()
{
int n;
clrscr();
printf("\nEnter the year:");
scanf("%d",&n);
if((n%400==0)((n%4==0)&&(n%100!=0)))
printf("Leap Year");
else
printf("Not a Leap Year");
getch();
}
output:
Enter the year:2003
Not a Leap Year
Enter the year:1312
Leap Year
Enter the year:1300
Not a Leap Year
Enter the year:1600
Leap Year
#include
int main()
{
int yr,n;
clrscr();
printf("\nPROGRAM TO CHECK IF THE GIVEN YEAR IS LEAP\n");
printf("Enter the year(example:1989):");
scanf("%d",&yr);
if(yr!=0)
{
n=yr%100;/*Extract tens and units place value*/
if((n%4)==0)
printf("\n%d IS A LEAP YEAR\n",yr);
else
printf("\n%d IS NOT A LEAP YEAR",yr);
}
else
{
printf("\nINVALID INPUT\n");
exit(1);
}
return 0;
getch();
}
# store year
yy=0
isleap="false"
echo -n "Enter year (yyyy) : "
read yy
# find out if it is a leap year or not
if [ $((yy % 4)) -ne 0 ] ; then
: # not a leap year : means do nothing and use old value of isleap
elif [ $((yy % 400)) -eq 0 ] ; then
# yes, it's a leap year
isleap="true"
elif [ $((yy % 100)) -eq 0 ] ; then
: # not a leap year do nothing and use old value of isleap
else
# it is a leap year
isleap="true"
fi
if [ "$isleap" == "true" ];
then
echo "$yy is leap year"
else
echo "$yy is NOT leap year"
fi
Check bellow link for other methods
http://bashscript.blogspot.com/2009/11/shell-script-to-check-whether-given.html
10 CLS: PRINT "Type the year you're interested in:"; : Input yr
20 Leap$ = "No"
30 If Int(yr/4) = yr/4 then Leap$ = "Yes"
40 If Int(yr/100) = yr/100 then Leap$ = "No"
50 If Int(yr/400) = yr/400 then Leap$ = "Yes"
60 PRINT: PRINT "Is the year"; yr; "a leap year ?"; " "; Leap$
First goto notepad and type in commands (each on their own line) as you would in command prompt. Then save the file as a batch file (.bat). Your file is now executable.
8086 assembly language program to check wether given number is perfect or not
write a program in C to check whether a given number is apalindrome or not
45
#include<stdio.h> #include<conio.h> void main() { int n; printf("ENTER NO FOR CHECK........ "); scanf("%d", &n); if(n%2==0) printf("Given No is EVEN"); else printf("Given No is ODD"); getch(); }
consider a/b * c/d check whether a/b and c/d are in simplest form. if not make them.. if they are then check whether a/d and c/b are in simple form. if no make them. if they are then the answer is going to be a simple fraction. example 3/8 * 12/5 the given fractions are already in simple form. now check whether 3/5 and 12/8 are in simple form. 12/ 8 is not in simple form. so canceling the multiple 4 12/8 = 3/2 now all fractions are simple therefore now the multiplication becomes 3/2 * 3/5 = 9/10
simple program
Solve simple intress usin fortran
[object Object]
write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html
Simple and easy solution:- http://codepad.org/svhkJpxp
Type your answer here... i think we should first enter 1 number then check it
Check the documentation of the String class, for a method that searches for a substring.