Escolar Documentos
Profissional Documentos
Cultura Documentos
Use of semicolan
C uses a semicolon (; ) to end a statement in much the
same way we use a period to end a sentence. Unlike line-
oriented languages
such as BASIC, an end-o f-line does not end a statement.
Variables and Storage :
Variable Declarations :
Assignment Statements
printf Function:
Special characters
#include<stdio.h>
Source code
#include<conio.h>
void main()
{
int a,b,c,d,e,f,flag=0;
const int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
printf("Enter first date");
scanf("%d%d%d",&a,&b,&c);
printf("Enter second date");
scanf("%d%d%d",&d,&e,&f);
while(c!=f||b!=e||a!=d)
{
a++;
if((b==4)||(b==6)||(b==9)||(b==11))
f=30;
else if(b==2)
{
if(d%4==0)
f=29;
else
f=28;
}
else
f=31;
if(a>f)
{
b++;
a=1;
}
if(b==13)
{
c++;
b=1;
}
flag++;
}
printf("%d",flag);
getch();
}
Output screen
Enter first date12
8
1999
Enter second date3
5
1995
2475
start
Read a,b,c,d,e,f,flag
Flag=0
Read a,b,c
Read d,e,f
While(c
! = f or
b!= e or
a!= d
a ++
if((b==4)|
if(b==2 F=31
|(b==6)||
(b==9)|| )
(b==11))
F = 30 if(d
%4== F=29
0)
if(a>
f)
F= 28
if(b=
b++; a=1;
=13)
flag
Write “flag”
stop
Flowchart