write a program which will count occurance of a day between
two dates.
Answer / abdul
//calculate num of date bet two dates.
#include<stdio.h>
#include<conio.h>
struct day
{
int date;
int month;
int year;
}x1,x2;
void main()
{
int n_day=0;
clrscr();
printf("\nenter date month and year for x1::");
scanf("%d%d%d",&x1.date,&x1.month,&x1.year);
printf("\nenter date month and year for x2::");
scanf("%d%d%d",&x2.date,&x2.month,&x2.year);
if(x1.year>x2.year)
n_day=n_day+(x1.year-x2.year)*365;
else
n_day=n_day+(x2.year-x1.year)*365;
if(x1.month>x2.month)
n_day=n_day+(x1.month-x2.month)*30;
else
n_day=n_day+(x2.month-x1.month)*30;
if(x1.date>x2.date)
n_day=n_day+(x1.date-x2.date);
else
n_day=n_day+(x2.date-x1.date);
printf("\n\n no. of days between entered two days=%d",n_day);
getch();
}
Is This Answer Correct ? | 20 Yes | 4 No |
code for copying two strings with out strcpy() function.
Array is an lvalue or not?
what is the output of below int n=10; (n++)++; printf("%d",n);
What is the difference between typeof(foo) and myFoo.GetType()?
What is structure padding ?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
how is the examination pattern?
What is the scope of static variables?
What is structure in c definition?
implement NAND gate logic in C code without using any bitwise operatior.
Write a program to find minimum between three no.s whithout using comparison operator.
Consider a language that does not have arrays but does have stacks as a data type.and PUSH POP..are all defined .Show how a one dimensional array can be implemented by using two stacks.