top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to design or program a clock in C?

0 votes
387 views

Does someone have a ready-made code then please share? it would be very helpful?

posted Jul 13, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
#include <stdio.h>
#include <time.h>

int main(void) {

    time_t rawtime;
    struct tm*  time_;

    time(&rawtime);
    time_ = localtime(&rawtime);

    printf("%i:%i:%i %i %i %i\n", time_->tm_hour, time_->tm_min, 
            time_->tm_sec, time_->tm_mday, time_->tm_mon+1,
            time_->tm_year+1900);

    return 0;
}
answer Aug 13, 2014 by Amit Kumar Pandey
This is cool sir I been looking this this answer several hours thank u Mr Admit Kumar Pandey
Similar Questions
+1 vote

How to create a c program to print a alphabet in the form of stars for ex.
A should be printed something like

   *
  * *
 *****
*     *

Do we have any standard algo???

0 votes

Can anyone help me with a C program to design a simple state machine by using macros?

Requirement
S1,S2,S3,S4 are the states and E1, E2,E3,E4,E5,E6,E7,E8 are events ...

when states moving from one state to another respective event should trigger
s1 to s2 ------> E1
s2 to s3 ------> E2
s3 to s4 ------> E3
s4 to s1 ------> E4
s1 to s4 ------> E5
s4 to s3 ------> E6
s3 to s2 ------> E7
s2 to s1 ------> E8

Please share the C program

+1 vote

How to write a c program for data signaling rate for four signals? Data signaling rate formula should be written in c language as formula cannot be inserted?

...