100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
College aantekeningen

Study materials

Beoordeling
-
Verkocht
-
Pagina's
62
Geüpload op
07-05-2023
Geschreven in
2022/2023

My documents helps to understand concept easily and important question to study in the semester,

Instelling
SRM











Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Documentinformatie

Geüpload op
7 mei 2023
Aantal pagina's
62
Geschreven in
2022/2023
Type
College aantekeningen
Docent(en)
Kelvin
Bevat
Alle colleges

Onderwerpen

Voorbeeld van de inhoud

SRM VALLIAMMAI ENGINEERING COLLEGE
(AN AUTONOMOUS INSTITUTION)
SRM Nagar, Kattankulathur – 603 203



DEPARTMENT OF GENERAL ENGINEERING
LAB MANUAL




I SEMESTER
1901010 - ‘C’ PROGRAMMING LABORATORY

Regulation – 2019

Academic Year 2022 – 2023 (ODD SEMESTER)


Prepared by


Dr. S.K.Saravanan, AP(Sel.G) / CSE Dr. S.Parthasarathy, AP(Sel.G) / CSE




1

, SYLLABUS

1901010 C PROGRAMMING LABORATORY LTPC
004 2
OBJECTIVES:
• To develop programs in C using basic constructs.
• To develop applications in C using arrays and functions.
• To develop applications in C using Strings and Structures.

List of Programs

1. Programs using I/O statements and expressions.
2. Programs using decision-making constructs.
3. Write a program to find whether the given year is leap year or Not? (Hint: not
everycenturion year is a leap. For example 1700, 1800 and 1900 is not a leap year)
4. Write a program to perform the Calculator operations, namely, addition, subtraction,
multiplication, division and square of a number.
5. Check whether a given number is Armstrong number or not?
6. Check whether a given number is odd or even?
7. Write a program to perform factorial of a number.
8. Write a C program to find out the average of 4 integers.
9. Show how to display array elements using two dimensional array.
10. Write a C program to perform swapping using function.
11. Display all prime numbers between two intervals using functions.
12. Reverse a sentence using recursion.
13. Write a program in C to get the largest element of an array using the function.
14. Write a C program to concatenate two string.
15. Write a C program to find the length of String.
16. Find the frequency of a character in a string.
17. Write a C program to Store Student Information in Structure and Display it.
18. The annual examination is conducted for 10 students for five subjects. Write a program to
read the data and determine the following:
(a) Total marks obtained by each student.
(b) The highest marks in each subject and the marks of the student who secured it.
(c) The student who obtained the highest total marks.


TOTAL: 60 PERIODS

COURSE OUTCOMES:

Upon completion of the course, the students will be able to

• Develop C programs for simple applications making use of basic constructs, arrays and strings.
• Develop C programs involving functions, recursion, pointers, and structures.
• Design applications using sequential and random access file processing.



2

, INDEX

S.No Topic Page No
Programs using I/O statements and expressions for sum of odd and even
1.
numbers.
4
Programs using decision-making constructs
2. a). Pay Calculation. 6
b). to find if a number is negative, positive or zero.
c). to check if entered alphabet is vowel or a consonant.
Write a program to find whether the given year is leap year or Not.
3. (Hint: not everycenturion year is a leap. For example 1700, 1800 and 11
1900 is not a leap year)
Write a program to perform the Calculator operations, namely, addition,
4.
subtraction, multiplication, division and square of a number. 13
5. Check whether a given number is Armstrong number or not. 16
6. Check whether a given number is odd or even. 18
7. Write a program to perform factorial of a number. 19
8. Write a C program to find out the average height of persons. 21
Two dimensional array with height and weight of persons and compute
9. 23
the Body Mass Index of the individuals.
10. Write a C program to perform swapping using function. 25
11. Display all prime numbers between two intervals using functions. 27
12. Reverse a sentence using recursion. 29
Write a program in C to get the largest element of an array using the
13. 30
function.
14. Write a C program to concatenate two string. 32
15. Write a C program to find the length of String. 34
16. Find the frequency of a character in a string. 35
17. Write a C program to Store Student Information in Structure and Display it. 37
18. The annual examination is conducted for 10 students for five subjects.
Write a program to read the data and determine the following:
(a) Total marks obtained by each student. 39
(b) The highest marks in each subject and the marks of the student who
secured it.(c) The student who obtained the highest total marks
Create a Railway reservation system in C with the following modules
• Booking
19. • Availability checking 43
• Cancellation
• Prepare chart
Additional C Programs for exercise 49
C Language Questions and Answers Viva – Voce 58

3

, Ex.No. : 1 Program using I/O Statements and Expressionsfor sum of odd and even
numbers.
Date :

Aim

To write a C Program to perform I/O statements and expressionsfor sum of odd and even
numbers..

ALGORITHM

1. Start
2. Declare variables and initializations
3. Read the Input variable.
4. Using I/O statements and expressions for computational processing.
5. Display the output of the calculations.
6. Stop


PROGRAM
/*
* Sum the odd and even numbers, respectively, from 1 to a given upperbound.
* Also compute the absolute difference.
* (SumOddEven.c)
*/
#include <stdio.h> // Needed to use IO functions
int main()
{
int sumOdd = 0; // For accumulating odd numbers, init to 0
int sumEven = 0; // For accumulating even numbers, init to 0
int upperbound; // Sum from 1 to this upperbound
int absDiff; // The absolute difference between the two sums
int number = 1;
// Prompt user for an upperbound
printf("Enter the upper bound: ");
scanf("%d", &upperbound); // Use %d to read an int
// Use a while-loop to repeatedly add 1, 2, 3,..., to the upperbound




4
€7,02
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten

Maak kennis met de verkoper
Seller avatar
yogeshn

Maak kennis met de verkoper

Seller avatar
yogeshn Veltech
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
0
Lid sinds
2 jaar
Aantal volgers
0
Documenten
12
Laatst verkocht
-

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen