Posts

Showing posts from July, 2021

INNER REDUCING PATTERN

Image
Consider the following I/O samples. SAMPLE INPUT:  4 SAMPLE INPUT:   4 4 4 4 4 4 4                                    4 3 3 3 3 3 4                                     4 3 2 2 2 3 4                                     4 3 2 1 2 3 4                                     4 3 2 2 2 3 4                                     4 3 3 3 3 3 4                           ...

C PROGRAM TO PRINT THE REMAINING DAYS AND COMPLETED DAYS FROM A GIVEN DATE

Image
  Consider the following I/O samples.   SAMPLE INPUT:  23 08 2000 SAMPLE OUTPUT:    Remaining Days : 130                                 Completed Days : 236                 C PROGRAM:    #include <stdio.h> int main() {     int d,m,y,sum=0;     scanf("%d %d %d",&d,&m,&y);     if(d>31 || m>12)         printf("Invalid");     else     {         switch(m)         {             case 1: sum+=31;             case 2:                  if((y%4==0 && y%100!=0) || y%400==0)                     sum+=29;         ...