
S.ABINAYA(205824102) S.JANANI(205824118) N.MONISHA(205824126) S.S.SIVANI(205824145) G.SUBHIKHSHA(205824149).
C & C++ INNOVATIVE CA. TOPIC: C PROGRAMS ON CALENDAR.
INTRODUCTION. The C programming language is a computer programming language that was developed to do system programming for the operating system UNIX and is an imperative programming language . The language has a small, fixed number of keywords, including a full set of control flow primitives: if/else , for , do/while , while and switch . User-defined names are not distinguished from keywords by any kind of sigil. It has a large number of arithmetic, bitwise, and logic operators: + , += , ++ , & , || ,etc..
More than one assignment may be performed in a single statement. The first line of the program #include <stdio.h> is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation. The next line int main() is the main function where the program execution begins. The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in the program. So such lines are called comments in the program..
The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen. The next line return 0; terminates the main() function and returns the value 0. # include <math.h> is used for mathematic functions in a program. The global section comprises of all the global declarations in the program. It is given by: float num = 2.54; int a = 5; char ch ='z‘;.
The size of the above global variables is listed as follows: char = 1 byte float = 4 bytes int = 4 bytes Main function is further categorized into local declarations, statements, and expressions. The curly braces mark the beginning and end of a function. It is mandatory in all the functions . scanf() It reads data from the standard input stream and writes the result into the specified arguments..
C PROGRAMS ON CALENDAR. C Programs to find the Leap Year C example to find the Day Name of a Week Days to Years Weeks and Days Number of Days in a Month.
C PROGRAMS TO FIND THE LEAP YEAR. /* C Program to Check Leap Year */ #include <stdio.h> int main() { int year; printf("\n Please Enter any year you wish \n "); scanf("%d", &year);.
if (( year%400 == 0)|| (( year%4 == 0 ) &&( year%100 != 0))) printf("\n %d is a Leap Year. \n", year); else printf("\n %d is not the Leap Year. \n", year); return 0; }.
17:zq S CppDroid Stopped Please Enter any 2026 terminal year you wish 2026 is not the Leap Year. Remove ad banner Get.
C PROGRAM TO FIND THE DAY NAME OF A WEEK. #include <stdio.h> int main() { int weekday; printf(" Please Enter the Day Number 1 to 7 (Consider 1= Monday, and 7 = Sunday) : "); scanf("%d", &weekday); switch (weekday).
{ case 1: printf("\n Today is Monday"); break; case 2: printf("\n Today is Tuesday"); break; case 3: printf("\n Today is Wednesday"); break; case 4: printf("\n Today is Thursday"); break;.
case 5: printf("\n Today is Friday"); break; case 6: printf("\n Today is Saturday"); break; case 7: printf("\n Today is Sunday"); break; default: printf("\n Please enter Valid Number between 1 to 7"); } return 0; }.
17:42 q, CppDroid terminal Stopped Please Enter the Day Number 1 to 7 (Consi der Monday, and 7 = Sunday) Today is Thursday' Remove ad banner 4 Get premium!.
C PROGRAM TO CONVERT DAYS TO YEARS WEEKS AND DAYS.
years = NoOfDays / 365; weeks = (NoOfDays % 365) / 7; days = (NoOfDays % 365) % 7; printf("\n Years = %d", years); printf("\n Weeks = %d", weeks); printf("\n Days = %d", days); return 0; }.
C PROGRAM TO PRINT NUMBER OF DAYS IN A MONTH. /* C Program to Print Number of Days in a Month using Else If Statement */ #include <stdio.h> int main() { int month; printf(" Please Enter the Month Number 1 to 12 (Consider 1 = January, and 12 = December) : "); scanf("%d", &month);.
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12 ) else if ( month == 4 || month == 6 || month == 9 || month == 11 ) else if ( month == 2 ).
else if ( month == 2 ) else printf("\n Please enter Valid Number between 1 to 12"); return 0; }.
THANK YOU!!!. DONE BY: S.ABINAYA(205824102) S.JANANI(205824118) N.MONISHA(205824126) S.S.SIVANI(205824145) G.SUBHIKHSHA(205824149).