- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
can someone tell me what those %7 and %4 means? I've tried solving it using calculator but my answers are really different from this code? [code]#include<stdio.h> main () { int year=1996, daycode; daycode=((year-1)*365+((year-1)/4)-((year-1)/100)+((year-1)/400)+1)%7; printf("%d",daycode); } [/code] and also this one [code]#include<stdio.h> main () { int year=1996, leapyear; leapyear=(!(year%4)&&(year%100))||!(year%4); printf("%d",leapyear); } … |
|
I dont really know how the whole program works. ?_? especially the first one. can someone tell me please. [CODE]#include<stdio.h> int dec_bin(int bin) { int x, y; x = y = 0; for(y = 7; y >= 0; y--) { x = bin / (1 << y); bin = bin … |
|
can someone help me to make this program look like this. example [img]http://www.ljzsoft.com/xlcalendar/sample/calendar_one_sheet_2x6.gif[/img] because some of the year cant display. [code]#include<stdio.h> #include<conio.h> int Calendar(int daycode,int year,int leapyear); int main(void) { int year; int daycode; int leapyear; for(year=1994;year<2000;year++) { leapyear=(!(year%4)&&(year%100))||!(year%4); daycode=((year-1)*365+((year-1)/4)-((year-1)/100)+((year-1)/400)+1)%7; Calendar(daycode,year,leapyear); } } int Calendar(int daycode,int year,int leapyear) { int … |
|
it keeps on saying '{' token error. did I put something wrong that the program keeps on saying '{' token error? [code] #include <stdio.h> #include <math.h> int Calendar(int daycode,int year,int leapyear); void dec_bin(int bin) { int x, y; x = y = 0; for(y = 7; y >= 0; y--) … |