Pranveer Singh Institute of Technology, Kanpur
Odd Semester 2025-26
B.Tech-First Year
Semester-I
LAB FILE
PROGRAMMING USING C (CS-152)
SUBMITTED TO: SUBMITTED BY:
NAME OF FACULTY: NAME OF STUDENT:
DESIGNATION: ROLL NO:
DEPARTMENT: BRANCH:
, LAB PROGRAMS INDEX
Lab
OBJECTIVES DATE MARKS SIGN.
No.
i) Money’s Interest
1
ii) Roots of Quadratic Equation
i) GCD of Two Numbers
2
ii) Nth Fibonacci Term
i) Armstrong in a Range
3
ii) Check Prime
i) Checking Perfect Number
4
ii) Pascal's Triangle Printing
i) GCD of two numbers
5
ii) Reverse by Recursion
i) Linear Searching
6
ii) Binary Searching
i) Bubble sort
7
ii) Matrix Multiplication
i) Anagram Strings
8
ii) Sorting N Strings
i) Creation and Traversing Linked List
9
ii) Topper from Student Records
i) Copy the content of one file into another.
10 ii) Save the records of n employees in the file.
, LAB-1
PROGRAM-1: Money’s Interest
OBJECTIVE: Interest is defined as the cost of borrowing money, as in the case of interest charged on a loan
balance. Interest can also be the rate paid for money on deposit, as in the case of a certificate of deposit. Interest
can be calculated in two ways: simple interest or compound interest. Simple interest is calculated on the
principal, or original, amount of a loan. Compound interest is calculated on the principal amount and the
accumulated interest of previous periods, and thus can be regarded as “interest on interest.”
Input Format:
A line contains three space separated values for: p, r & t.
Output Format:
Print Simple-Interest and Compound-Interest values separated by space in two decimal places
PROGRAM:
#include<stdio.h>
#include<math.h>
int main()
{
int p,t;
float r,ci,si;
scanf("%d %f %d",&p,&r,&t);
si=(p*r*t)/100;
ci=p*pow((1+r/100),t)-p;
printf("%.2f %.2f",si,ci);
return 0;
}
1
Odd Semester 2025-26
B.Tech-First Year
Semester-I
LAB FILE
PROGRAMMING USING C (CS-152)
SUBMITTED TO: SUBMITTED BY:
NAME OF FACULTY: NAME OF STUDENT:
DESIGNATION: ROLL NO:
DEPARTMENT: BRANCH:
, LAB PROGRAMS INDEX
Lab
OBJECTIVES DATE MARKS SIGN.
No.
i) Money’s Interest
1
ii) Roots of Quadratic Equation
i) GCD of Two Numbers
2
ii) Nth Fibonacci Term
i) Armstrong in a Range
3
ii) Check Prime
i) Checking Perfect Number
4
ii) Pascal's Triangle Printing
i) GCD of two numbers
5
ii) Reverse by Recursion
i) Linear Searching
6
ii) Binary Searching
i) Bubble sort
7
ii) Matrix Multiplication
i) Anagram Strings
8
ii) Sorting N Strings
i) Creation and Traversing Linked List
9
ii) Topper from Student Records
i) Copy the content of one file into another.
10 ii) Save the records of n employees in the file.
, LAB-1
PROGRAM-1: Money’s Interest
OBJECTIVE: Interest is defined as the cost of borrowing money, as in the case of interest charged on a loan
balance. Interest can also be the rate paid for money on deposit, as in the case of a certificate of deposit. Interest
can be calculated in two ways: simple interest or compound interest. Simple interest is calculated on the
principal, or original, amount of a loan. Compound interest is calculated on the principal amount and the
accumulated interest of previous periods, and thus can be regarded as “interest on interest.”
Input Format:
A line contains three space separated values for: p, r & t.
Output Format:
Print Simple-Interest and Compound-Interest values separated by space in two decimal places
PROGRAM:
#include<stdio.h>
#include<math.h>
int main()
{
int p,t;
float r,ci,si;
scanf("%d %f %d",&p,&r,&t);
si=(p*r*t)/100;
ci=p*pow((1+r/100),t)-p;
printf("%.2f %.2f",si,ci);
return 0;
}
1