Prob1. In the Gregorian calendar, which is the calendar used by most modern countries, the following rules decides which years are leap years:
Reading assignment: Read about the "switch" instruction in C and design a solution based on it.
Prob 2. The following program calculates i raised to power k.
#include <stdio.h>
int i, j, ans, k;
main ()
{
printf("Supply number (+ve integer) and exponent(+ve integer) \n");
scanf("%d %d",&i,&k);
printf("%d\n",k);
ans = 1; /* initialization*/
j = k;
while (j >= 1)
{
ans = ans*i ;
j = j - 1;
}
printf("%d raised to %d is %d\n", i, k, ans);
}
(i) Modify this program so that it can handle non-positive integers also.
(ii) Enhance the capability of the program such that given a 2 by 2 matrix, A it can compute A raised to a (non-negative) integer. You can choose any convention for the input/output format of the matrix.