Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Project C

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

GOVERNMENT POLYTECHNIC COLLEGE

KUNNAMKULAM
KIZHOOR (PO), THRISSUR (DT),
KERALA PIN:680503

C PROGRAMMING GROUP REPORT


2021-2022
CALENDAR SYSTEM USING C
GROUP MEMBERS
MOHAMMED RAZEEN K
MOHAMMED FADHIL SALEEM
MANIKANDAN PB
DIRECTORATE OF TECHNICAL EDUCATION

GOVERNMENT POLYTECHNIC COLLEGE


KUNNAMKULAM

KIZHOOR(PO), THRISSUR(DT),
KERALA PIN : 680509

CERTIFICATE
That is to certify that the report of group project titled programming using C ‘ was presented by
______________ Reg no:______________ partial fulfilment of the requirement for the award of diploma
in computer engineering under the technical education department during the academic year 2022 at
Government Polytechnic College, Kunnamkulam.
DATE :

PLACE : STAFF IN CHARGE

EXTERNAL EXAMINER:
INTERNAL EXAMINER: HEAD OF THE SECTION
ACKNOWLEDGEMENT

At first, I like to express my indebtedness to the Almighty God who showered His abundant grace on me take
this project a success. I wish to my sincere thanks to seena I T our principal and Seena IT head of the
department of computer engineering for their valuable guidance and also thanks to provide as all necessary
facilities. I would like to extend my gratitude to main instructor of the IT lab, sabu kurian for providing and
leading to the necessary information to do the project. I am extremely thankful to our respected lecturers
for their keen interest and valuable suggestions in this project in addition I would like to all staff members
of computer department and all my friends of CT S3 for their suggestion and constructive critics.
ABSTRACT

In the last few years, the C programming language has become one of the most widely used
languages for applications and systems software on microcomputer systems. This paper describes
the C language and its history.
C is a procedural Programming language with a static system that has the functionality of
structured programming, recursion, and lexical variable scoping. C was created with constructs that
transfer well to common hardware instructions. It has a long history of use in programs that were
previously written in assembly language.
C programming language is a machine-independent programming language that is mainly used to
create many types of applications and operating systems such as Windows, and other complicated
programs such as the Oracle database, Git, Python interpreter, and games and is considered a
programming foundation in the process of learning any other programming language.
TABLE OF CONTENT

1. Introduction
2. What is C programming
3. Uses of C programming
4. Advantages and disadvantage
5. C keywords
6. C operators
7. Array
8. Recursive function
9. Program report
10. Conclusion
11. Reference
INTRODUCTION

C is a procedural programming language. It was initially developed by Dennis Ritchie in the year 1972. It was
mainly developed as a system programming language to write an operating system. The main features of
the C language include low-level memory access, a simple set of keywords, and a clean style, these features
make C language suitable for system programming like an operating system or compiler development.
Many later languages have borrowed syntax/features directly or indirectly from the C language. Like syntax
of Java, PHP, JavaScript, and many other languages are mainly based on the C language. C++ is nearly a
superset of C language (Few programs may compile in C, but not in C++).
WHAT IS C PROGRAMMING

C is an imperative procedural language supporting structured programming, lexical variable scope


and recursion, with a static type system. It was designed to compiled to provide low level access to
memory and language constructs that map efficiently to machine instructions, all with minimal run
time support.

Example:

#include <stdio.h>
int main() {
// printf() displays the string inside quotation
printf("Hello, World!");
return 0;
}

Out put : Hello, World


USES OF C PROGRAMMING
• Creating computer applications.
• Writing embedded software.
• Firmware for micro controllers in electronics and communications.
• Development of verification software, testing code, simulator, etc.. for various applications and
hardware.
• Creating compiles of different languages to take input from other languages and convert into lower
level machine languages.
• Implement OS operations.
• C language was used to develop UNIX kernel.

ADVANTAGES AND DISADVANTAGES OF C


ADVANTAGES
• Easy to write
• Low cost
• Fast execution speed
• Portable
• Easy debugging
• Procedure oriented language
• Speed of compilation
• Execution of algorithm and data structure

DISADVANTAGES
• Lack of object orientation
• Inefficient memory management
• No garbage collection
• Concept of namespace is not presented in c
• Absence of exception handling

C OPERATORS
ARRAY
An array in C is a collection of items stored at contiguous memory locations and elements can be accessed
randomly using indices of an array. They are used to store similar type of elements as in the data type must
be the same for all elements. They can be used to store collection of primitive data types such as int, float,
double, char, etc of any particular type.
Different ways of declaring an Array

1. Array declaration by specifying size


Eg: int A[10];
2. Array declaration by initializing elements
Eg: int A[] = { 10, 20, 30, 40 }

3. Array declaration by specifying size and initializing elements


Eg: int A[6] = { 10, 20, 30, 40 }
Advantages of an Array:
1. Random access of elements using array index.

2. Use of less line of code as it creates a single array of multiple elements.


3. Easy access to all the elements.
4. Traversal through the array becomes easy using a single loop.
5. Sorting becomes easy as it can be accomplished by writing less line of code.

Disadvantages of an Array:
It allows us to enter only fixed number of elements into it. We cannot alter the size of
the array once array is declared. Hence if we need to insert more number of records than
declared then it is not possible. We should know array size at the compile time itself
TWO DIAMENSIONAL ARRAY

An array of arrays is known as 2D array. The two dimensional (2D) array is also known as matrix. A matrix
can be represented as a table of rows and columns. The syntax to declare the 2D array is given below.
data_type array_name[rows][columns];
Initialization of Two Dimensional Array

There are two ways to initialize a two Dimensional arrays during declaration.
1. int A[2][3] = { {10, 11, 12},{14, 15, 16}};
int A[][3] = { {10, 11, 12},{14, 15, 16}};

2. int A[2][3] = { 10, 11, 12, 14, 15, 16};


int A[][3] = { 10, 11, 12, 14, 15, 16};

RECURSIVE FUNCTION
A function that calls itself is known as a recursive function. And, this technique is known as recursion. While
using recursion, programmers need to be careful to define an exit condition from the function, otherwise it
will go into an infinite loop. Recursion makes program elegant. However, if performance is vital, use loops
instead as recursion is usually much slower.
PROGRAM REPORT
#include<stdio.h>
#define TRUE 1

#define FALSE 0
int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
char *months[]=
{

“ “,
“\n\n\nJanuary”,
“\n\n\nFebruary”,
“\n\n\nMarch”,

“\n\n\nApril”,
“\n\n\nMay”,
“\n\n\nJune”,
“\n\n\nJuly”,
“\n\n\nAugust”,

“\n\n\nSeptember”,
“\n\n\nOctober”,
“\n\n\nNovember”,
“\n\n\nDecember”
};
int inputyear(void)
{
int year;

printf(“Please enter a year : “);


scanf(“%d”, &year);
return year;
}
int ddaycode(int year)

{
int daycode;
int d1, d2, d3;
D1 = (year – 1.)/ 4.0;
D2 = (year – 1.)/ 100.;

D3 = (year – 1.)/ 400.;


daycode = (year + d1 – d2 + d3) %7;
return daycode;
}

int dleapyear(int year)


{
if(year% 4 == FALSE && year%100 != FALSE || year%400 == FALSE)
{

days_in_month[2] = 29;
return TRUE;
}
else
{

days_in_month[2] = 28;
return FALSE;
}
}
void calendar(int year, int daycode)
{
int month, day;
for ( month = 1; month <= 12; month++ )

{
printf(“%s”, months[month]);
printf(“\n\nSun Mon Tue Wed Thu Fri Sat\n” );
for ( day = 1; day <= 1 + daycode * 5; day++ )

{
printf(“ “);
}

for ( day = 1; day <= days_in_month[month]; day++ )

printf(“%2d”, day );
if ( ( day + daycode ) % 7 > 0 )

printf(“ “ );
else
printf(“\n “ );
}

daycode = ( daycode + days_in_month[month] ) % 7;


}
}

int main(void)
{

int year, daycode, leapyear;


Year = inputyear();
daycode = ddaycode(year);
dleapyear(year);
Calendar(year, daycode);

printf(“\n”);
}
OUTPUT:
CONCLUSION:
Mini project “Calendar Application” is also a simple project built in C. It displays a nicely formatted
calendar of every month.

REFERENCE:
• www.cprogaming
• www.programiz.com
• www.tutorialspoint.com
• www.Youtube.com

You might also like