Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

C - Programming Manual

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

C - Programming Manual

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

909 - SENTHUR POLYTECHNIC COLLEGE

(Approved by DOTE, Govt. of Tamilnadu and AICTE, New Delhi)


SAVAKATTUPALAYAM,NAMBIYUR – 638460
DEPARTMENT OF ELECTRONICS AND
COMMUNICATION ENGINEERING

PRACTICAL OBSERVATION NOTE BOOK

4040360 – PROGRAMMING IN C
PRACTICAL

Name

Register Number

Year / Semester
4040360 PROGRAMMING IN C PRACTICAL

1. Write C program to calculate simple interest and compound interest.


2. Write C program to find the solution of a quadratic equation.
3. Write C program to find whether the given number is even or odd.
4. Write C program to find the sum of series using ‘While’ loop.
5. Write C program to perform The Arithmetic operation based on the numeric key
press using switch case statement.(1-Addition,2-Subtraction,3–multiplication,
4-Division).
6. Write C program to find the biggest number among three numbers.
7. Write C program to print Fibonacci series.
8. Write C program to find factorial of given N numbers using function.
9. Write C program to prepare the total marks for N students by reading the Name,
Reg. No, Marks 1 to Marks 6 using array of structure.
10. Write C program to swap the vales of two variables.
11. Write C program to calculate the sum and average of given three numbers using
function.
12. Write C program to sort the names in alphabetical order.
13. Write C program to count the number of digits in a given integer and print the
reverse number.
14. Write C program for matrix addition.

15. Write C program to print multiplication table.


INDEX

S.NO DATE NAME OF THE EXPERIMENT MARKS SIGN


INDEX

S.NO DATE NAME OF THE EXPERIMENT MARKS SIGN


INDEX

S.NO DATE NAME OF THE EXPERIMENT MARKS SIGN


EX. NO: DATE:

SIMPLE INTEREST AND COMPOUND INTEREST

AIM

ALGORITHM
Step 1: Start the program
Step 2: Read Principal Amount, Rate of interest, and Time
Step 3: Calculate Simple Interest by using formula
SI = (P*N*R)/100
Step 4: Calculate Compound Interest by using the formula
CI=P*pow (1+R/100, N) -P
Step 5: Print Simple Interest and Compound Interest
Step 6: Stop the program
RESULT
EXP. NO: DATE:

QUADRATIC EQUATION

AIM:

ALGORITHM
Step 1: Start the program
Step 2: Read a, b, c values
Step 3: Calculated by using the formula
d=b2 – 4*a*c
Step 4: Test the condition, if d >0roots are real and unequal
Step 5: Calculate the root1, root2 by using the formula
r1=(-b+sqrt (d))/ (2*a), r2=(-b-sqrt(d))/(2*a)
Step 6: If d =0, roots are real and equal
r1=-b/2*a, r2=-r1
Step 7: If d <0, then print roots a reimaging binary
r1=-b/2*a, r2=sqrt(-d)/(2*a)
Step 8: Print root1, root2by using the formula
Step 9: Stop the program.
RESULT
EX. NO: DATE:

GIVEN NUMBER EVEN OR ODD

AIM

ALGORITHM
Step 1: Start the program
Step 2: Read the number
Step 3: Check the condition, if number (N)%2 == 0, Then
Step 4: Print N is an Even Number
Step 5: If condition is false print N is odd number
Step 6: Stop the program
RESULT
EX. NO: DATE:
SUM OF SERIES USING WHILE LOOP

AIM

ALGORITHM
Step 1: Start the program
Step 2: Read the value of n
Step 3: Initialize i=1, sum=0
Step 4: Test the condition, if i<=n, if true go to next step
sum=sum+i; i=i+1
Step 5: Test i<=n, if false go to step 6.
Step 5: Repeat the step4 until (i<=n) using loop
Step 6: Display the sum.
Step 7: Stop the program
RESULT
EX. NO: DATE:
ARITHMETIC OPERATIONS USING SWITCH CASE STATEMENT

AIM:

ALGORITHM
Step 1: Start the program
Step 2: Read the values of two numbers (n1, n2)
Step 3: Display the menu to choose an appropriate choice to the user.
1. Addition
2. Subtraction
3. Multiplication
4. Division

Step 4:Get the users choice as input


 If the choice is 1, then addition operation will be performed on two numbers using
switch case statement.
 If the choice is 2, then subtraction operation will be performed on two numbers using
switch case statement
 If the choice is 3, then multiplication operation will be performed on two numbers
using switch case statement
 If the choice is 4,then division operation will be performed on two numbers using
switch case statement
 If the choice is other than these numbers then default information “Invalid Choice”
will be displayed
Step 5: Stop the program
RESULT:
EX. NO: DATE:

LARGEST NUMBERS BETWEEN GIVEN THREE NUMBERS


AIM

ALGORITHM
Step1: Stare the program
Step 2: Declare the three variables
Step 3: Read the three variables
Step 4: Compare the three values and display the biggest numbers
Step 5: Stop the program
RESULT
EX. NO: DATE:
FIBONACCI SERIES

AIM

ALGORITHM
Step 1: Start the program
Step 2: Declare the three variables
Step 3: Read the value of n
Step 4: Initialize the value f1=-1, and f2=1
Step 5: Using for loop calculate the Fibonacci series and its sum
Step 6: Print the series and its sum
Step 7: Stop the program
RESULT:
EX. NO: DATE:

FACTORIAL OF GIVEN NUMBER USING FUNCTION


AIM

ALGORITHM
Step 1: Start the program
Step 2: Declare the variables
Step 3: Read the value of n
Step 4:Initialize fact=1, i=1
Step 5: If i<=n, calculate fact=fact*i at „n‟ times using loop
Step 6: Print fact
Step 7: Stop the program
RESULT
EX. NO: DATE:
STUDENT MARK
AIM

ALGORITHM
Step 1: Start the program
Step 2: Declare the structure with variables
Step 3:Create a structure variable using array
Step 4: Read the students details using loop
Step 5: Print the collected student details and their total marks
Step 5: Stop the program
RESULT
EX. NO: DATE:

SWAP TWO VARIABLES


AIM

ALGORITHM
Step 1: Start the program
Step 2: Declare two variables (a,b)
Step 3: Swap two variables using third variable(c)
c=a
a=b
b=c
Step 4: After swapping print the value of a and b
Step 5: Stop the program
RESULT
EX. NO: DATE:

SUM AND AVERAGE USING FUNCTION


AIM

ALGORITHM
Step 1:Start the program
Step 2: Declare the user defined functions sum and avg to calculate the sum and average of given
numbers
Step 3: Declare the required variables
Step 4: Calculate the sum and average using functions
Step 5: Print the sum and average
Step 6: Stop the program
RESULT
EX. NO: DATE:

SORT NAMES IN ALPHABETICAL ORDER


AIM

ALGORITHM
Step 1: Start the program
Step 2: Declare the variables
Step 3: Read the string as input
Step 4: Compare each character of each string with all other using strcmp() function in for loop
Step 5: Print the result
Step 6: Stop the program
RESULT
EX. NO: DATE:

COUNT THE NUMBER AND PRINT IN REVERSE NUMBER


AIM

ALGORITHM
Step 1: Start the program
Step 2: Declare the variables
Step 3: Execute while loop until num becomes 0
Step 4: To separate each digit modulo is used r=num%10
Step 5: The digit are reversed and stored in variable „rev‟
Step 6: Remove last digit num/10;
Step 7: Stop the program
RESULT
EX. NO: DATE:

MATRIX ADDITION
AIM

ALGORITHM
Step 1: Start the program
Step 2: Declare the variables
Step 3: Read the elements for first matrix as rows and columns using 2 for loops
Step 4: Read the elements for second matrix as rows and columns using 2 for loops
Step 5: Apply addition and print the result
Step 6: Stop the program
RESULT
EX. NO: DATE:

MULTIPLICATION TABLE

AIM

ALGORITHM
Step 1: Start the program
Step 2: Declare the variables
Step 3: Read the number n to display the multiplication table
Step 4: Print the multiplication table using do while loop
Step5: Stop the program
RESULT

You might also like