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

INVESTIGATORY PROJECT

REPORT
In
COMPUTER SCIENCE
(‘C’ Programming Language)
On
To calculate total marks &
Percentage
SUBMITTED TO –
MRS. RAJNI GAUTAM
(COMPUTER FACULTY)
Submitted by –

Name : Meghna
Father’s Name : Mr. Kuldeep Daga
Class-Section : X-A
Roll No. : 21

Meghna Class-X-A
TABLE OF CONTENTS

 Introduction

 Certificate

 Acknowledgement

 Aim

 Introduction to the topic

 Program

 Coding

 Output

 Conclusion

Meghna Class-X-A
INTRODUCTION TO ‘C’
Introduction
‘C’ is a programming language developed in 1972 at Bell Laboratories by Dennis
Ritchie. The ‘C’ programming language used for development the different types of
software.

Some Features of ‘C’ Language

1. All programs written in lower case alphabets.


2. Compile a program using ALT+F9.
3. Run a program using CTRL+F9.
4. Display output using ALT+F5.
5. Display full screen of coding window F5.

Structure of a program

Every C program consists of one of more modules called functions. One of these
functions is called main. The programs begin executing by main function and access
other function, if any. Functions are written after or before main function separately.
A function has -

(1) Heading consists of name with list of arguments (optional) enclosed in


parenthesis.

(2) Argument declaration (if any) and

(3) Compound statement enclosed in two braces { } such that each statement
ends with a semicolon.

Comments, which are not executable statement, of necessary can be placed in


between /* and */.

Meghna Class-X-A
#include<stdio.h>This statement used for include Standard Input Output
Header files in our program. This header file performs all standard input
output operations like printf and scanf.

#include<conio.h>This statement used for include Console Input Output


Header file in our program. This header file perform all Console operations or
functions like clrscr( ) and getch( ).

clrscr( ) Function – Used for clear output screen.


getch( ) Function – Used for hold the output screen until press any key.
Keywords – Keywords are the reserved words in ‘C’ language. They have
own meaning and are used for some special purpose. Standard keywords are
auto, break, case, char, int, void, float etc.

Identities – Identities are names given to various program elements like


variables, arrays, and functions. The name should begin with a letter and other
characters can be letters and digits and also can contain underscore character (
_ ) like area, average, x12, name, place_name etc.

Data Type
‘C’ language has five types data type –
1. Integer
2. Character
3. Floating Point
4. Double
5. Void

Integer:-Integer data type is used to operate integer arithmetic operations


and this type variable always store integer values. This types of variable take
two byte in the memory.
Syntax - <data type><variable name>
Example – intnum; ---> where int is a data type and num is a variable

Meghna Class-X-A
Character:- Character data type is used to hold character in 8 bits or 1 byte.
Syntax –
<data type><list of parameters or variables>
Example – char name, address etc.

Floating Point: (Real Number or Real Data)


The float data type is used to define real numbers or real data types.
Syntax –
<data type><list of parameters or variables>
Example – float salary, amount;

Void:
Has three uses –
1. To declare void with the name of the function means returning no value.
2. To declare void within the function argument means no arguments..
3. To create a generic pointer.
Syntax –
void name of function
Escape Sequence: An escape sequence is used to express non printing
characters like a new line, tab etc. It begin with backslash ( \ ) followed by
letter like a, n, b, t, v, r etc. The commonly used escape sequences are –
\a – for alert
\b – backspace
\n – new line
\f – form feed
\0 – null

Meghna Class-X-A
Variable: - A variable is an identifier that is used to represent some specified
type of information. Only a single data can be stored in a variable. The data
stored in the variable is accessed by its name, before using a variable in a
program, the data type it has to store is to be declared.
int a, b, c;
a=10;
b=20

Declarations of Variable:
This is for specifying data type. All the variables, functions etc must be
declared before they are used. A declaration tells the compiler the name and
the type of a variable you will be using in your program. A declaration
consists of the type, the name of the variable, and a terminating semicolon.

Operators:
There are for types of operator –
1. Arithmetic Operator: - Used for arithmetic operation like (+, -, x, /, %)
2. Unary Operator: - A operator acts up on a single operand to produce a
new value is called a unary operator. The Increment (++) and Decrement
(- -) operator, they increase the value by 1.
3. Relational Operator: - < (less than), <= (less than or equal to), >
(greater than), >= (greater than or equal to), = = (equal to) and != (not
equal to) are relational operator.
4. Logical Operator: - && (and) and || (or) are logical operators which are
used to connect logical expressions.
5. Assignment Operator:- These operator are used for assigning a value
of expression to another identifier. =, +=, -=, *=, /= and %= are
assignment operator.
6. Conditional Operator:- The operator ?: is conditional operator. It is
used as Variable1=expression1 ?expression2 : expression3.

Meghna Class-X-A
Data Input Output
For inputting and outputting data we use library function, the important of
these functions are getchar( ), putchar( ), printf ( ), gets( ), puts( ). For using
these functions in a ‘C’ program there should be a preprocessor statement
#include<stdio.h>.

getchar function:
It is used to read a single character (char type) from keyboard. The syntax is
char variable name = getchar( );

Example –
char c;
c=getchar( );

putchar function:
It is used to display single character. The syntax is –
putchar (char c);

Example –
char c;
c=’a’;
putchar(c);

scanf Function
This function is generally used to read any data type – int, char, double, float, string.

Syntax – scanf(control string, list of arguments);

The control string consists of group of characters, each group beginning % sign and
a conversion character indicating the data type of the data item.

Example –

scanf(“%d%s%f”,&x,name,&salary);

Meghna Class-X-A
Printf Function
This is the most commonly used function for outputting a data of any type.

Syntax –

printf(control string, list of arguments)

Meghna Class-X-A
CERTIFICATE

This is to certify that “Meghna” has completed this project report under my

guidance on application “To calculate total marks & Percentage” in ‘C’

Programming Language during the year 2019-2020. They are submitting this

project report in partial fulfillment of the requirements for the award of

qualifying examination.

Mrs. RAJNI GAUTAM

(Computer Teacher)

Meghna Class-X-A
ACKNOWLEDGEMENT

I, Meghna wish to express our gratitude with a great pleasure towards respected

principal Mrs. Rajni Ohri for providing all the facilities. I am equally indebted

Mrs. Rajni Gautam for the constant encouragement and able to guidance the

rendered to me for completing this study.

I am also highly obliged to my parents who helped me financially to undertake

and complete this work last but not the least I am immensely grateful to

colleagues for their coordination in completing this work.

Submitted By:-

Name : Meghna
Father’s Name : Mr. Kuldeep Daga
Class-Section : X-A
Roll No. : 21

Meghna Class-X-A
AIM

“To calculate total marks & Percentage” using ‘C’ Programming

Language.

Meghna Class-X-A
Introduction to the Topic
Control Statements
When we run a program, the statements are executed in the order in which they
appear in the program. Also each statement is executed only once. But in many
cases we may need a statement or a set of statements to be executed a fixed number
of times or until a condition is satisfied. Also we may want to skip some statements
based on testing a condition. For all these we use control statements –

Control statements are of two types –


Branching – It is to execute one of several possible options depending on the
outcome of a logical test, which is carried at some particular point within a program.

Looping – It is to execute a group of instructions repeatedly, a fixed no of times


or until a specified condition is satisfied.

Branching –
1. If …. Else Statement – it is used to carry out one of the two possible
actions depending on the outcome of a logical test. The else partion is
optional.
Syntax – if(expression)
statement1
else
statement2
2. Nested if statement
Within if block or else block another if…else statement can come. Such
statements are called nested if statement.
Syntax –
if (expression1)
statement1
if (expression2)
Statement2
else
statement3

Meghna Class-X-A
3. Ladder if statement –
In order to create a situation in which one of several courses of action is
executed we used ladder..if statement
Syntax –
if (expression1) statement1
if (expression2) Statement2
if (expression3) Statement3
----------------------------
else statement n

Meghna Class-X-A
Make a program to calculate total marks, %age, division of a
student in five subject in C.
#include<stdio.h>
#include<conio.h>
void main()
{
inteng,maths,sci,sst,hindi;
floattotal,per,div;
clrscr();
printf(“Enter Marks of English, Maths, Science, Social, Hindi”);
scanf(“%d%d%d%d%d”,&eng,&maths,&sci,&sst,&hindi);
total=eng+sci+maths+sst+hindi;
per=total*100/500;
if (per>=60)
printf(“Ist”);
else if (per>=12)
printf(“2nd");
else if (per>=33)
printf(“3rd");
else
printf(“Failed”);
printf(“Total Marks : - %f“,total);
printf(“Percentage of Marks : - %f“,per);
printf(“Division : - %f“,div);
getch();
}

Meghna Class-X-A
CODING IN Turbo ‘C’

Meghna Class-X-A
OUTPUT

Meghna Class-X-A
CONCLUSION

In this project we want to show the use of Array in ‘C’ Programming.Thisprogram


to calculate total marks & Percentage.

Control Statements
When we run a program, the statements are executed in the order in which they
appear in the program. Also each statement is executed only once. But in many
cases we may need a statement or a set of statements to be executed a fixed number
of times or until a condition is satisfied. Also we may want to skip some statements
based on testing a condition. For all these we use control statements –

Control statements are of two types –


Branching – It is to execute one of several possible options depending on the
outcome of a logical test, which is carried at some particular point within a program.

Looping – It is to execute a group of instructions repeatedly, a fixed no of times


or until a specified condition is satisfied.

Meghna Class-X-A

You might also like