Advertisement
LeTuanAnh

Time

Oct 13th, 2015
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <time.h>
  4. int main(){
  5.  
  6.     int nam;
  7.     int hientai;
  8.  
  9.     time_t rawtime;
  10.     struct tm timeinfo;  
  11.     time(&rawtime);
  12.     localtime_s(&timeinfo, &rawtime);
  13.     hientai = timeinfo.tm_year +1900;
  14.  
  15.  
  16.     printf("\nNhap nam sinh: ");
  17.     scanf_s("%d", &nam);
  18.  
  19.     int tuoi = hientai - nam;
  20.     printf("\nBan sinh nam %d nen nam nay ban %d tuoi", hientai, tuoi);
  21.  
  22.  
  23.     _getch();
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement