Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

converting time in c

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() {
   char t[10];
   scanf("%s", t);

   if(t[8] == 'P') {
     if(t[0] != '1' || t[1] != '2') {
       t[0]++;
       t[1]+=2;
     }
   } else {
     if(t[0] == '1' && t[1] == '2') {
       t[0] = '0';
       t[1] = '0';
     }
   }
   t[8] = '';
   printf("%s
", t);
    
   return 0;
}
Source by programs.programmingoneonone.com #
 
PREVIOUS NEXT
Tagged: #converting #time
ADD COMMENT
Topic
Name
8+9 =