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 |
Can we assign string to char pointer?
Tell me when would you use a pointer to a function?
How does selection sort work in c?
main() { printf(5+"good morning"); printf("%c","abcdefgh"[4]); }the o/p is morning and e...how someone explain
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
write a program to add two numbers of any size.....(remember any size)
Who developed c language and when?
implement general tree using link list
write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1
Why cd or dvd are round why not square.
how will you write a program on linked lists using JAVA programming???????????
How would you use the functions fseek(), freed(), fwrite() and ftell()?
0 Answers Aspire, Infogain, TISL,