Your Ad Here

Question: Write a program where it asks the user to input the amount of days in the desired month and also the starting day (1=SUN, 2=MON,3=TUES. etc).

The Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
#include <stdio.h>
#include <stdlib.h>
 
int main(void)
{
    int i = 0, day_of_week = 0, number_of_days = 0;
    printf("Enter the number of days in the month:\n");
    scanf("%d",&number_of_days);
    printf("Enter starting day of the week:\n 1=SUN 2=MON 3=TUE...\n");
    scanf("%d",&day_of_week);
 
 
    for (i = 1; i < day_of_week; i++)
        printf("   ");
 
    for (i = 1; i <= number_of_days; i++)
    {
        printf("%2d ", i);
        if(day_of_week == 7)
        {
           printf("\n");
           day_of_week = 0;
        }
        day_of_week++;
    }
    printf("\n");
    system("pause");
    return 0;
}

Output Example:

Number of Days: 29

Starting on Tuesday

Your Ad Here

A friend of mine gave me the Pioneer SX-316 Home Theater Receiver System a few months back. Last week, the volume knob stopped working, the volume would not go up or down and I didn’t have the remote control. This receiver is a little old but it sounds amazing.

I contacted Pioneer to purchase the remote but they charge $22, which is too high for a system this old. I decided to try with a universal remote control first and then if i had no sucess I was going to purchase the Pioneer remote control.

Read the rest of this entry »

Bible Verse

Ads