Accept & Display Marks For Five Student Using Array
Accept & Display Marks For Five Student Using Array
REPORT
In
COMPUTER SCIENCE
(‘C’ Programming Language)
On
Accept & display marks for five
student using array
SUBMITTED TO –
MRS.RAJNI GAUTAM
(COMPUTER FACULTY)
Submitted by –
Introduction
Certificate
Acknowledgement
Aim
Program
Coding
Output
Conclusion
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 -
(3) Compound statement enclosed in two braces { } such that each statement
ends with a semicolon.
Data Type
‘C’ language has five types data type –
1. Integer
2. Character
3. Floating Point
4. Double
5. Void
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
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.
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.
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);
Syntax –
This is to certify that “Aparna Tiwari”has completed this project report under
my guidance on application “Accept & display marks for five student using
array” in ‘C’ Programming Language during the year 2019-2020. They are
submitting this project report in partial fulfillment of the requirements for the
(Computer Teacher
I, Aparna Tiwari wish to express our gratitude with a great pleasure towards
respected principal Mrs. Rajni Ohri for providing all the facilities. I am equally
indebted Ms. Rajni Gautam for the constant encouragement and able to
and complete this work last but not the least I am immensely grateful to
Submitted By:-
“Accept & display marks for five student using array” using ‘C’
Programming Language.
Introduction
An array refers to a group of objects of the same data type.It is a data structure
through which a programmer can store and perform operations on a collection of
data values of same data type and same size. An array can holds multiple values at a
time.
Types of Arrays –
1. Single Dimension Array or one dimension array consists of finite number of
homogeneous elements.
2. Multi-Dimension Array consists of finite number of homogeneous elements
each of which itself is an array.
If the array elements declare with 5 index or subscripts of int data type, it take 10
byte memory of computer. It depends on the data type used with array declaration.
Example -
float marks[3][4];
where 3 rows and 4 columns and total element in this declaration 3 x 4 = 12.
Array of String
#include<stdio.h>
#include<conio.h>
void main( )
{
clrscr( );
ini, mark[5];
printf(”Enter the marks of five subject of a student : “);
for(i=1;i<=5;i++)
{
printf(”\n Marks of Subject : %d“,i);
scanf(“%d”,&mark[i-1];
}
printf(”\n The Marks you have entered are : “);
for(int i=1;i<=5;i++)
{
printf(”\n Marks of Subject : %d\t“, i, marks[i-1]);
}
getch( );
}
In this project we want to show the use of Array in ‘C’ Programming. This program
Accept & display marks for five student using array.
An array refers to a group of objects of the same data type.It is a data structure
through which a programmer can store and perform operations on a collection of
data values of same data type and same size. An array can holds multiple values at a
time.
Types of Arrays –
1. Single Dimension Array or one dimension array consists of finite number of
homogeneous elements.
2. Multi-Dimension Array consists of finite number of homogeneous elements
each of which itself is an array.