Record Note: Subject: C Programming NAME:Tharun Kailash.k Roll No.: Class

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 125

RECORD NOTE

SUBJECT: C PROGRAMMING

NAME :Tharun kailash.k

ROLL NO. :

CLASS : M.Sc., Software Systems

EX. DATE TITLE PG.NO Staff


No sign

EX. DATE TITLE PG.NO Staff


No sign
EX. DATE TITLE PG.NO Staff
No sign
EX. DATE TITLE PG.NO Staff
No sign
EX. DATE TITLE PG.NO Staff
No sign
Expt no: 1 SUM OF TWO NUMBERS

Aim:
To get two input values from the user and calculate the sum of two
numbers and print the value of sum.
Algorithm:

Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no 2
TEMPERATURE CONVERSION: CELSIUS TO FAHRENHEIT

Aim:
To accept the temperature value in Celsius and convert it into Fahrenheit
value. Also print the value in Fahrenheit.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.3
TEMPERATURE CONVERSION: FARENHEIT TO CELCIUS
Aim:
To accept the value of temperature in Fahrenheit scale and convert it into
Celsius value. Also print the value in Celsius scale.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.4
AREA AND PERIMETER OF SQUARE

Aim:
To accept the value of one side of a square from the user and calculate
and print the area and perimeter of the square.
Algorithm:

Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.5
AREA AND PERIMETER OF RECTANGLE
Aim:
To accept the length and breadth of a give rectangle and calculate and
print the area and perimeter of the rectangle.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.6
AREA AND PERIMETER OF CIRCLE
Aim:
To accept the radius of the circle from the user and calculate and print the
area and perimeter of the circle.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.7
AREA AND PERIMETER OF TRIANGLE
Aim:
To accept three sides of a triangle from the user and calculate and print
the area and perimeter of the triangle.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.8
TO CALCULATE SIMPLE INTEREST
Aim:
To accept the values of principal amount,rate of interest and time from
the user and calculate and print the value of simple interest.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.9
TO CALCULATE COMPOUND INTEREST
Aim:
To accept the values of principal amount, rate of interest and time from
the user and calculate and print the value of compound interest.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.10
TO FIND GREATEST OF THREE NUMBERS
Aim:
To accept three numbers from the user and print the greatest value among
the three numbers.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.11
SWAPPING OF TWO NUMBERS USING TEMP VARIABLE
Aim:
To accept two values from the user in two different variables and swap
their values .Also print their values after swapping with the help of temporary
variable.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.12
SWAPPING OF TWO NUMBERS WITHOUT TEMP. VARIABLE
Aim:
To accept two values from the user in two different variables and swap
their values .Also print their values after swapping without the help of
temporary variable.

Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.13
TO FIND THE GREATEST OF TWO NUMBERS
Aim:
To accept three values from the user and print the greatest value.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.14
ELIGIBILITY TO VOTE
Aim:
To find the voting eligibility of a person by getting the age of a person as
input.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no15
TO CHECK WHETHER A NUMBER IS POSITIVE OR NEGATIVE
Aim:
To accept a number from the user and check whether it is positive or
negative.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.16
TO CHECK WHETHER A NUMER IS ODD OR EVEN
Aim:
To accept a value from the user and check whether the number is odd or
even.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.17
TO DIVIDE TWO NUMBERS WITH CONDITION B!=0

Aim:
To accept two values from the user and perform division and print the
quotient .
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.18
AVERAGE OF MARKS OF A STUDENT AND PRINTING THE GRADE
Aim:
To accept five marks of a student from the user and check whether all the
marks are above 50.If yes, then find the average and print the grade of the
student according to the average. If not, print fail.
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.19
TO FIND WHETHER PROFIT OR LOSS

Aim:
To accept the cost price and selling price of an item from the user and
print whether profit or loss.
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.20
TO FIND THE ASCENDING AND DESCENDING ORDER FOR A GIVEN
SET OF NUMBERS.
Aim:
To accept three values from the user and print the values in ascending and
descending order.
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.21(a)
TO FIND ODD OR EVEN
A)USING MODULUS OPERATOR

Aim:
To accept a number from the user and print whether the number is odd or
even using modulus operator.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.21(b) USING BITWISE OPERATOR
Aim:
To accept a number from the user and print whether the number is odd or
even using bitwise operator.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.21(c)
WITHOUT USING MODULUS AND BITWISE OPERATOR

Aim:
To accept a number from the user and print whether the number is odd or
even without using modulus and bitwise operator.
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.21(d) CONDITIONAL OPERATOR
Aim:
To accept a number from the user and print whether the number is odd or
even using conditional operator.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.

Expt no.22
TO CHECK WHETHER DIVISIBLE BY 5OR NOT AND DIVISIBLE BY 7 BUT
NOT 11

Aim:
To write a program that asks a number and test the number whether it is
multiple of 5 or not, divisible by 7 but not by eleven.
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no. 23
PRINTS 1 IF ANY TWO ARE SIMILAR AND PRINTS 0 IF ALL ARE
UNIQUE

Aim:
To write a C program that accepts three integers from the keyboard. It
prints out number 1 if any two of them (or all of them) are equal and prints out
zero if all of them are different.

Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.24 TO FIND WHETHER LEAP YEAR OR NOT

Aim:
To write a C program that takes a positive integer argument representing
a calendar year and returns integer 1 if it is a leap year else 0.

Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.

Expt no.25 TO CALCULATE THE ROOTS OF AN EQUATION


Aim:
Write a C program to accept a, b and c (from the keyboard) of the
quadratic equation ax2+bx+c = 0 such that the condition b < a + c < 0 holds. If
the condition does not hold, then the program terminates with a message
“Wrong Input". It then ends the real root(s) and prints with two decimal places.
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.26
TO FIND WHETHER A GIVEN ALPHABET IS A VOWEL OR CONSONANT.

Aim:
To write a program to find whether a given character is a Vowel or
consonant. A character is taken as input. The character may be in Upper Case or
in Lower Case.
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.27 TO FIND THE SMALLEST OF 3 NUMBERS

Aim:
To write a C Program to Find the Smallest Number  among Three
Numbers (integer values) .

Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.28 TO FIND THE TYPE OF TRIANGLE BASEDON THE GIVEN SIDES

Aim:
The lengths of three sides are taken as input. Write a C program to find
whether a triangle can be formed or not. If not display “This Triangle is NOT
possible.” If the triangle can be formed then check whether the triangle formed
is equilateral, isosceles, scalene or a right-angled triangle. (If it is a right-angled
triangle then only print that it is a Right-angle triangle does not print it as
scalene triangle). 
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.29 TO CALCULATE THE ELECTRICITY BILL

Aim:
To write a program in C to calculate and print the Electricity bill of a
given customer. The customer id., name and unit consumed by the user should
be taken from the keyboard and display the total amount to pay to the customer.
The charge are as follow: 

Unit Charge/unit

Upto 100 Nil

Upto 199 @1.20

200 and above but @1.50


less than 400

400 and above but @1.80


less than 600

600 and above @2.00


If bill exceeds Rs. 400 then a surcharge of 15% will be charged and the
minimum bill should be of Rs. 100/-
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.30
TO CHECK WHETHER THE SET OF NUMBERS OBEY PYTHAGORAS THEOREM

Aim:
Three numbers form a Pythagorean triple if the sum of squares of two
numbers is equal to the square of the third. For example, 3, 5 and 4 form a
Pythagorean triple, since 3*3 + 4*4 = 25 = 5*5 You are given three integers, a,
b, and c. They need not be given in increasing order. If they form a Pythagorean
triple, then print "yes", otherwise, print "no". Please note that the output
message is in small letters.
Algorithm:
Flowchart:

Program:
Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.

Expt no.31 SUM AND PRODUCT OF THREE FLOAT NUMBERS


Aim:
To write a program that requests three floating point numbers, and prints
their sum and product to three decimal places.
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.32 PRINTING CERTAIN VALUES USING VARIOUS OPERATORS

Aim:
To print the value of y for given x=2 & z=4 and analyze the output.
a). y = x++ + ++x;
b). y= ++x + ++x;
c). y= ++x + ++x + ++x;
d). y = x>z;
e). y= x>z? x:z;
f). y = x&z;
g). y= x>>2 + z<<1;
Algorithm:
Flowchart:
Program:

Output:
Case-a:
Case-b:

Case-c:
Case-d:

Case-e:
Case-f:

Case-g:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.33
HEIGHT AND TIME TAKEN FOR AN OBJECT AT HIGHEST POINT

Aim:

Suppose an object is thrown up with initial velocity of 50m/sec. How


hight the object will rise and what time does it take to reach the highest point?

Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.34
GRAVITATIONAL FOECE BETWEEN A PERSON AND EARTH

Aim:

Two persons are standing apart by 1m, each has a mass of 50kg. Let
G=6.67x10-11Nm2/kg2 and rearth=6.64x106m. Determine the force of F gravitation
between P1 and P2. How many times should F be multiplied to get the force of
gravitation between the Earth and P1?

Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.35 TO CALCULATE THE MOLECULES IN SNOWFLAKES

Aim:

To find how many molecules of H2O are present in 1 gm of snowflakes?


Given that Avogadro number=6.022x1023, and atomic mass of H=1.01 and that
of O=15.9994.

Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.
Expt no.36 TO CALCULATE THE MASS OF AIR OF AN AUTOMOBILE.

Aim:
To calculate the mass of air in an automobile tire using following
formula.,PV=0.37m(T+460)Where P=Pressure, pounds per square inch (psi),
V=Volume (cubic feet) and m=mass of air (pounds) and T=temperature
(degrees in Fahrenheit).
Algorithm:
Flowchart:
Program:

Output:

Result:
The program is executed without any errors and the expected output is
obtained successfully.

You might also like