0% found this document useful (0 votes)
28 views14 pages

FYBScIT Practicals

The document outlines a series of practical programming exercises for a C programming and DBMS course, including algorithms, flowcharts, and source code for various tasks such as calculating simple interest, finding the greatest of three numbers, and checking for leap years. It also includes instructions for creating a mini project on a bank management system. Each practical task is structured to enhance programming skills through hands-on coding and problem-solving.

Uploaded by

alpharambo001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views14 pages

FYBScIT Practicals

The document outlines a series of practical programming exercises for a C programming and DBMS course, including algorithms, flowcharts, and source code for various tasks such as calculating simple interest, finding the greatest of three numbers, and checking for leap years. It also includes instructions for creating a mini project on a bank management system. Each practical task is structured to enhance programming skills through hands-on coding and problem-solving.

Uploaded by

alpharambo001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

FY-B.Sc-IT RollNo.

Practical 1
C Programming + DBMS

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:

SUBJECT: Programming with C

INDEX

Sr Practical Sign
No.
1 a) To calculate simple interest taking principal, rate of interest and number of
years as input from user. Write algorithm & draw flowchart for the same.
b) Write a program to find greatest of three numbers using conditional
operator. Write algorithm & draw flowchart for the same.
c) Write a program to check if the year entered is leap year or not. Write
algorithm & draw flowchart for the same.
2 a) Write a program to calculate roots of a quadratic equation.
b) Write a menu driven program using switch case to perform add / subtract/
multiply / divide based on the users choice.
c) Write a program to print the pattern of asterisks.
3 a) Write a program using while loop to reverse the digits of a number.
b) Write a program to calculate the factorial of a given number.
c) Write a program to print the Fibonacci series.
4 a) Write a program to print area of square using function.
b) Write a program using recursive function.
c) Write a program to square root, abs () value using function.
d) Write a program using goto statement.
5 a) Write a program to print rollno and names of 10 students using array.
b) Write a program to sort the elements of array in ascending or descending
order.
6 a) Write a program to extract the portion of a character string and print the
extracted part.
b) Write a program to find the given string is palindrome or not.
c) Write a program to using strlen(), strcmp() function .
7 Write a program to swap two numbers using a function. Pass the values to be
swapped to this function using call-by-value method and call-by-reference
method.
8 a) Write a program to read a matrix of size m*n.
b) Write a program to multiply two matrices using a function.
9 Write a program to print the structure using
Title
Author
Subject
Book ID
Print the details of two students.
10 Create a mini project on “Bank management system”. The program should be
menu driven.

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
MODULE 1:- PROGRAMMING WITH C

Practical No.: 01
1. A) To calculate simple interest taking principal, rate of interest and number of years as input from user. Write
algorithm & draw flowchart for the same.

Solution:

Algorithm

Step1: Start
Step2: Input principal (P), rate of interest (R), and number of years (T)
Step3: Calculate Simple Interest (SI) using the formula: SI = (P * R * T)/100
Step4: Output the Simple Interest (SI)
Step5: End

Flowchart:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
Source code:

#include <stdio.h>

int main()
{
// Variables to store user inputs
scanf("%f", &R);

printf("Enter the number of years: ");


float P,R,T,SI;

// Get user input


printf("Enter the principal amount: ");
scanf("%f", &P);

printf("Enter the annual interest rate (in percentage): ");

scanf("%f", &T);

// Calculate simple interest


SI=(P*R*T)/100;

// Display the result


printf("The simple interest is: %.2f\n",SI);

return 0;

Output:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
1. B) Write a program to find greatest of three numbers using conditional operator. Write algorithm & draw
flowchart for the same.

Solution:
Algorithm:

Step1: Start

Step2: Input a,b,c.

Step3: Check weather a>b && a>c Then Print “a is greater”

Step4: Else Check b > c Then Print “b is greater”

Step5: Else print “c is greater”

Step6: End

Flowchart:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
Source Code:

#include<stdio.h>
int main()
{
int a,b,c;

printf("Enter any three numbers:\n");


scanf("%d%d%d",&a,&b,&c);

if(a>b && a>c)


printf("%d is greater",a);
else if(b>c) printf("%d is greater",b);
else
printf("%d is greater",c);

return 0;
}

Output:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
1. C) Write a program to check if the year entered is leap year or not. Write algorithm & draw flowchart for the
same.

Solution:
Algorithm:

Step1: Start

Step2: Read year from user.

Step3: Check if the year is divisible by 4 but not by 100 using if-else statements and logical operator.

Step4: And Also check if the variable is divisible by 400 using the logical operator or.

Step5: If either of the two conditions is satisfied, then print that the given year is a leap year.

Step6: Otherwise not.

Step7: End

Flowchart:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
Source Code:

#include <stdio.h>

int main()
{
int year;

printf("Enter a year- ");


scanf("%d",&year);

if (((year % 40==0) && (year % 100!=0)) || (year % 400==0))


printf("%d is a leap year.", year);
else
printf("%d is not a leap year.", year);

return 0;
}

Output:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
Practical No.: 02

2. A) Write a program to calculate roots of a quadratic equation.

Solution:

−b ± √ b2−4 ac
We’ll need to use Quadratic Formula: x=
2a

Source Code:

Output:

2. B) Write a menu driven program using switch case to perform add / subtract / multiply / divide based on the
users choice.

Solution:

2. C) Write a program to print the pattern of asterisks.

Solution:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
Practical No.: 03

3. A) Write a program using while loop to reverse the digits of a number.

Solution:
Source Code:

#include <stdio.h>

void main() {
int num, rev = 0, rem;

printf("Enter an integer: ");


scanf("%d", &num);

while(num != 0) {
rem = num % 10;
rev = rev * 10 + rem;
num /= 10;
}

printf("Reversed Number = %d", rev);

Output:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
3. B) Write a program to calculate the factorial of a given number.

Solution:
Source Code:

Output:

c. Write a program to print the Fibonacci series.

Solution:
Source Code:

Output:

Practical No.: 04

a. Write a program to print area of square using function.

Solution:
Source Code:

Output:

b. Write a program using recursive function.

Solution:
Source Code:

Output:

c. Write a program to square root, abs() value using function.

Solution:
Source Code:

Output:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:
d. Write a program using goto statement.

Solution:
Source Code:

Output:

Practical No.: 05

a. Write a program to print rollno and names of 10 students using array.

Solution:
Source Code:

Output:

b. Write a program to sort the elements of array in ascending or descending order

Solution:
Source Code:

Output:

Practical No.: 06

a. Write a program to extract the portion of a character string and print the extracted part.

Solution:
Source Code:

Output:

b. Write a program to find the given string is palindrome or not.

Solution:
Source Code:

Output:

Date: ` Programming with C + DBMS


FY-B.Sc-IT RollNo.:

c. Write a program to using strlen(), strcmp() function .

Solution:
Source Code:

Output:

Practical No.: 07

Write a program to swap two numbers using a function. Pass the values to be swapped to this function using
call-by-value method and call-by-reference method.

Solution:
Source Code:

Output:

Practical No.: 08

a. Write a program to read a matrix of size m*n.

Solution:
Source Code:

Output:

b. Write a program to multiply two matrices using a function.

Solution:
Source Code:

Output:

Practical No.: 09

Write a program to print the structure using

Title
Date: ` Programming with C + DBMS
FY-B.Sc-IT RollNo.:
Author

Subject

Book ID

Print the details of two students.

Solution:
Source Code:

Output:

Practical No.: 10

Create a mini project on “Bank management system”. The program should be menu driven.

Solution:
Source Code:

Output:

Date: ` Programming with C + DBMS

You might also like