#include <stdio.h>
int main(int argc, char * argv[]) {
int year;
if(argc!=2)
{
printf("\nArgument not in Correct Format\n");
exit(0);
}
year=atoi(argv[1]);
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
printf("\n%d is a leap year\n", year);
else
printf("\n%d is not a leap year\n", year);
return 0;
}
int main(int argc, char * argv[]) {
int year;
if(argc!=2)
{
printf("\nArgument not in Correct Format\n");
exit(0);
}
year=atoi(argv[1]);
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
printf("\n%d is a leap year\n", year);
else
printf("\n%d is not a leap year\n", year);
return 0;
}
Output:
4 Comments
This comment has been removed by the author.
ReplyDeleteI didn't understand what u want to say. But if u r looking for complete question then try https://simpleway2code.blogspot.in/2017/10/tcs-placement-paper-question.html
Deleteplease upload more mcq questions based on c
ReplyDeleteyou are very knowledgable man this website is of great help for us tcs aspirants thank you!
ReplyDelete