Question: #include / / Function to print the name of the day of the week void printDayName ( int day, int month, int year ) {

#include
// Function to print the name of the day of the week
void printDayName(int day, int month, int year){
// Array to store the names of the days of the week
char *days[]={"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
// Array to store the number of days in each month
int daysInMonth[]={31,28,31,30,31,30,31,31,30,31,30,31};
// Check if the year is a leap year (adjusting for KSA time)
if ((year %4==0 && year %100!=0)|| year %400==0){
daysInMonth[1]=29; // February has 29 days in a leap year
}
// Calculate the total number of days since January 1st
int totalDays =0;
for (int i =0; i < month -1; i++){
totalDays += daysInMonth[i];
}
totalDays += day;
// Adjust for the year 2024(leap year)
totalDays +=1;
// Calculate the day of the week (0= Sunday, 1= Monday, ...,6= Saturday)
int dayOfWeek =(totalDays -1)%7;
// Print the name of the day of the week
printf("The day of the week for %d/%d/%d is %s.
", day, month, year, days[dayOfWeek]);
}
int main(){
int day, month, year;
// Input the day, month, and year from the user
printf("Enter the day (1-31): ");
scanf("%d", &day);
printf("Enter the month (1-12): ");
scanf("%d", &month);
printf("Enter the year (e.g.,2024): ");
scanf("%d", &year);
// Call the function to print the day of the week
printDayName(day, month, year);
return 0;
}
Implement Eight of the following Nine Tasks [8 marks]
a. Show the Variables in the stack.
b. Show the parameters in the stock.
c. Show the value of old EIP (return address) stored in
the stack frame.
d. Show the value of old EBP stored in the stack frame,
(i.e., EBP of the caller function).
e. Address stored in the EIP register.
f. Address stored in the EBP register.
g. Address of the stack pointer ESP.
h. Address stored in the instruction pointer (address of
the code that will be executed next).
i. Content of the instruction registers (the code that is
currently being executed).
note: we want debug in the 9 task using "gdb peda" in kali linux
please help we need it today becuase we have to submit it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!