write a program to print calender using for loop.
Answer / abdul rahman
// Callender for 2011
#include<stdio.h>
#include<string.h>
char* month(int);
main()
{
int mm,d,m,st,start=6,count,day=0;
for(m=1;m<=12;m++)
{printf("\n");
puts(month(m));
printf("\n");
printf("su\tmo\ttu\twe\tth\tfr\tsa\n");
for(st=start;st>0;st--)
{
printf("\t");
day++;
}
if(m<8)
{
if(m%2)
count=31;
else
{count=30;
if(m==2)
count=28; }
}
else
{
if(m%2)
count=30;
else
count=31;
}
for(d=1;d<=count;d++)
{
if(start==7)
{start=0;
printf("\n");
}
printf("%d\t",d);
start++;
}
printf("\n");
}
}
char* month(int a)
{
switch (a)
{
case 1:return("Jan");
case 2:return("Feb");
case 3:return("Mar");
case 4:return("Apr");
case 5:return("May");
case 6:return("Jun");
case 7:return("Jul");
case 8:return("Aug");
case 9:return("Sep");
case 10:return("Oct");
case 11:return("Nov");
case 12:return("Dec");
default: return(0);
}
}
| Is This Answer Correct ? | 9 Yes | 0 No |
Write a program to find minimum between three no.s whithout using comparison operator.
How can I read data from data files with particular formats?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
int arr[] = {1,2,3,4} int *ptr=arr; *(arr+3) = *++ptr + *ptr++; Final contents of arr[]
What are local static variables?
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
0 Answers Lovely Professional University,
which header file contains main() function in c?
17 Answers Google, HCL, TCS,
How many bytes are occupied by near, far and huge pointers (dos)?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
In header files whether functions are declared or defined?
what is the difference between procedure oriented and object oriented progaming language
define c