C - Programming Manual
C - Programming Manual
4040360 – PROGRAMMING IN C
PRACTICAL
Name
Register Number
Year / Semester
4040360 PROGRAMMING IN C PRACTICAL
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:
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
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:
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:
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:
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:
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:
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