0% found this document useful (0 votes)
25 views

Null Flowchart

Flowcharts

Uploaded by

asghar_107
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)
25 views

Null Flowchart

Flowcharts

Uploaded by

asghar_107
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/ 33

MSB Educational Institute – Haidery

Class X - Computer Science


Practical Portfolio

Submitted by: _____________________


Examination Seat No: _______________
Date: 08/04/2023
Project Completion Certificate

This is to certify that , son/daughter


of of class X has carried out the
necessary practical work for the academic year
2022-2023 as per the syllabus.

_______________ ______________
Signature Signature
Computer Science Head of the
Teacher Department

______________
School Stamp

Index
S.No Practical Date Signature
SLO 9: Fundamentals of C Programming : (Arithmetic, relational, logical operators)
1. Write a program using all data types.
2. Write a program using Increment/Decrement operators.
3. Find the sum, product and average of given numbers.
Write C programs that use format specifiers (%d, %f, %s, %c), escape
sequences (alert, backspace, newline, carriage return, tab, backslash,
4.
single quotation mark, double quotation mark, question mark),
comments (//, /* */).
5. Convert Celsius to Fahrenheit temperature and vice versa.
Find the volume of a cube, cylinder, sphere or any other geometrical
6.
shape.
SLO 10: Selection Statement Programs: (if,then,else, swtich)
Calculate the grades of students on the basis of marks. The score sheet
7.
should contain name of the student, father’s name and class.
8. Show whether a number is positive, negative or zero.
9. Find the maximum and minimum values from inputted numbers.
10. Show whether a number is even or odd.
Generate the utility bill on the basis of charges allocated to each unit
11.
range. The bill should contain meter number and consumer name.
12. Determine whether a given number is prime number or not.
SLO 11: Loop Structure Programs: (For,while,do-while)
Generate a number series (even, odd, prime etc.) by taking input of
13.
starting and ending point.
14. Generate sum of series using loops.
15. Generate table of any inputted number up to the inputted range.
16. Calculate factorial of any inputted number.
Generate Fibonacci series starting from an inputted number and
17.
ending till the inputted range.
Print pyramid, rectangle, square or any geometrical shape using nested
18.
loops.
Input multiple values using loop and calculate average, maximum or
19.
minimum value using selection statement.
SLO 13: Office Automation II – ( MS Excel 2007 or Above )
20. Apply cell formatting tools like; number, alignment, font, border, fill.
Apply different functions to the data, i.e sum, average, count,
21.
minimum and maximum.
22. Insert a pie chart and bar graph in the data sheet.
23. Apply filter and data validation on spreadsheet data.
24. Protect a worksheet.
25. Lock/ unlock cells of spreadsheet.
PROGRAM # 1
#include <stdio.h>
int main() {

// Integer (int)

int age = 25;

// Character (char)

char initial = 'G';

// Float (float)

float pi = 3.14159;

// Double (double)

double large_number = 1234567890.123456;

// String (represented as an array of char)

char name[] = "Hello, world!";

// Print values

printf("Integer: %d\n", age);

printf("Character: %c\n", initial);

printf("Float: %f\n", pi);

printf("Double: %lf\n", large_number);

printf("String: %s\n", name);

return 0;

Algorithm
Step 1: Start

Step 2: Define the main() function, which serves as the entry point of the program.

Step 3: Declare variables of different data types (int, char, float, double, char[]) and initialize them with
respective values.

Step 4: Print the values of these variables using the printf function.

Step 5: Return 0 to indicate successful execution of the program.

Step 6: Stop
Flowchart:

Start

Input variables:
( Int , char , float , double)

Initializing

Output: print the values of


variables

End
PROGRAM # 2
#include <stdio.h>

int main() {

int num1 = 10, num2 = 10;

// Prefix increment (value incremented before use)

printf("Prefix increment:\n");

printf("num1 before: %d\n", num1);

printf("num1 after: %d\n", ++num1);

// Postfix increment (value used first, then incremented)

printf("\nPostfix increment:\n");

printf("num2 before: %d\n", num2);

printf("num2 after: %d\n", num2++);

// Prefix decrement (value decremented before use)

printf("\nPrefix decrement:\n");

printf("num1 before: %d\n", num1);

printf("num1 after: %d\n", --num1);

// Postfix decrement (value used first, then decremented)

printf("\nPostfix decrement:\n");

printf("num2 before: %d\n", num2);

printf("num2 after: %d\n", num2--);

return 0;

}
Algorithm
Step 1:Start

Step 2: Initialize two integer variables, num1 and num2, both with a value of 10.

Step 3: Print a header for prefix increment operation.

Step 4: Print the value of num1 before incrementing.

Step 5: Increment num1 using prefix increment (++num1) and print the updated value.

Step 6: Print a header for postfix increment operation.

Step 7: Print the value of num2 before incrementing.

Step 8: Use postfix increment (num2++) on num2 and print the previous value (value before incrementing).

Step 9: Print a header for prefix decrement operation.

Step 10: Print the value of num1 before decrementing.

Step 11: Decrement num1 using prefix decrement (--num1) and print the updated value.

Step 12: Print a header for postfix decrement operation.

Step 13: Print the value of num2 before decrementing.

Step 14: Use postfix decrement (num2--) on num2 and print the previous value (value before decrementing).

Step 15: Stop


Start

Input integers:
Num1, Num 2

Increment

Output: print the values of integers after


increment

Decrement

Output: print the values of integers after


decrement

End
PROGRAM # 3
#include <stdio.h>

int main() {

int num1, num2, num3;

int sum, product;

float average;

printf("Enter three numbers: ");

scanf("%d %d %d", &num1, &num2, &num3);

sum = num1 + num2 + num3;

product = num1 * num2 * num3;

average = (float)sum / 3;

printf("Sum: %d\n", sum);

printf("Product: %d\n", product);

printf("Average: %.2f\n", average);

return 0;

}
Algorithm
Step 1: Declare variables num1, num2, and num3 to store three integers.

Step 2: Declare variables sum, product, and average to store the sum, product, and average of the three
numbers, respectively.

Step 3: Prompt the user to enter three numbers.

Step 4: Read the three numbers entered by the user and store them in variables num1, num2, and num3.

Step 5: Calculate the sum of the three numbers and store it in the variable sum.

Step 6: Calculate the product of the three numbers and store it in the variable product.

Step 7: Calculate the average of the three numbers by dividing the sum by 3 and store it in the variable average.

Step 8: Print the sum, product, and average.

Step 9: Stop

PROGRAM # 4
#include <stdio.h>

int main() {

int integerVariable = 10;

float floatVariable = 3.14;

char characterVariable = 'A';

char stringVariable[] = "Hello, World!";

printf("Integer: %d\n", integerVariable);

printf("Float: %f\n", floatVariable);

printf("Character: %c\n", characterVariable);


printf("String: %s\n", stringVariable);

printf("Alert sound: \a\n");

printf("Backspace: \b\n");

printf("Newline: \n");

printf("Carriage return: \r");

printf("Tab: \t\tText after tab\n");

printf("Backslash: \\ \n");

printf("Single quotation mark: \' \n");

printf("Double quotation mark: \" \n");

printf("Question mark: \? \n");

return 0;

Algorithm

Step 1 : Start

Step2 : Include necessary header files.

Step 3: Define the main function.

Step 4: Declare and initialize variables of different data types (integer, float, char, and string

Step 5: Print values of each variable using printf function with appropriate format specifiers.

Step 6: Use escape sequences to print special characters.

Step 7 : stop
PROGRAM # 5

#include <stdio.h>

int main() {

int choice;

float temperature, convertedTemp

printf("Temperature Conversion Menu:\n");

printf("1. Celsius to Fahrenheit\n");

printf("2. Fahrenheit to Celsius\n");

printf("Enter your choice: ");

scanf("%d", &choice);

switch(choice) {

case 1:

printf("Enter temperature in Celsius: ");

scanf("%f", &temperature);

convertedTemp = (temperature * 9 / 5) + 32;

printf("Temperature in Fahrenheit: %.2f\n", convertedTemp);

break;

case 2:

printf("Enter temperature in Fahrenheit: ");

scanf("%f", &temperature);

convertedTemp = (temperature - 32) * 5 / 9;


printf("Temperature in Celsius: %.2f\n", convertedTemp);

break;

default:

printf("Invalid choice\n");

return 0;

Algorithm
Step 1: Start

Step 2: Display the temperature conversion menu including options for Celsius to Fahrenheit and
Fahrenheit to Celsius.

Step 3: Use a switch statement to execute different code based on the user's choice.

Step 4: If the user chooses option 1 (Celsius to Fahrenheit), prompt the user to enter the temperature
in Celsius, read the input, and perform the conversion using the formula (temperature * 9 / 5) + 32 .

Step 5: If the user chooses option 2 (Fahrenheit to Celsius), prompt the user to enter the temperature
in Fahrenheit, read the input, and perform the conversion using the formula (temperature - 32) * 5 / 9.

Step 6: Display the converted temperature. Step 8: If the user enters an invalid choice, display a
message indicating that the choice is invalid.

Step 7: End the program.

PROGRAM # 6

#include <stdio.h>

int main() {

int choice;

float volume, side, radius, height;


printf("Choose a shape to calculate its volume:\n");

printf("1. Cube\n");

printf("2. Cylinder\n");

printf("3. Sphere\n");

scanf("%d", &choice);

switch(choice) {

case 1:

printf("Enter the side length of the cube: ");

scanf("%f", &side);

volume = side * side * side;

printf("Volume of the cube: %.2f\n", volume);

break;

case 2:

printf("Enter the radius of the cylinder: ");

scanf("%f", &radius);

printf("Enter the height of the cylinder: ");

scanf("%f", &height);

volume = PI * radius * radius * height;

printf("Volume of the cylinder: %.2f\n", volume);

break;

case 3:

printf("Enter the radius of the sphere: ");

scanf("%f", &radius);

volume = 4.0 / 3.0 * PI * radius * radius * radius;

printf("Volume of the sphere: %.2f\n", volume);

break;

default:
printf("Invalid choice!\n");

break;

return 0;

Algorithm
Step 1: Start

Step 2: Prompt the user to choose a shape (cube, cylinder, or sphere).

Step 3: Read the user's choice.

Step 4: Based on the user's choice: - If the choice is 1 (Cube): - Prompt the user to enter the side
length of the cube. - Read the side length. - Calculate the volume of the cube using the formula:
volume = side * side * side. - Display the volume of the cube. - If the choice is 2 (Cylinder): - Prompt
the user to enter the radius of the cylinder. - Read the radius. - Prompt the user to enter the height of
the cylinder. - Read the height. - Calculate the volume of the cylinder using the formula: volume = PI *
radius * radius * height. - Display the volume of the cylinder. - If the choice is 3 (Sphere): - Prompt the
user to enter the radius of the sphere. - Read the radius. - Calculate the volume of the sphere using the
formula: volume = 4.0 / 3.0 * PI * radius * radius * radius. - Display the volume of the sphere. - If the
choice is none of the above: - Display "Invalid choice!".

Step 5: End the program

PROGRAM # 7

#include <stdio.h>

int main() {

char name[50], fatherName[50], className[20];

int marks;

// Input

printf("Enter student's name: ");


scanf("%s", name);

printf("Enter father's name: ");

scanf("%s", fatherName);

printf("Enter class: ");

scanf("%s", className);

printf("Enter marks: ");

scanf("%d", &marks);

// Grade Calculation

char grade;

if (marks >= 90)

grade = 'A';

else if (marks >= 80)

grade = 'B';

else if (marks >= 70)

grade = 'C';

else if (marks >= 60)

grade = 'D';

else

grade = 'F';

printf("\nStudent's Name: %s\n", name);

printf("Father's Name: %s\n", fatherName);

printf("Class: %s\n", className);

printf("Marks: %d\n", marks);

printf("Grade: %c\n", grade);

return 0;

Algorithm
Step 1: Start

Step 2: Declare variables: - name, fatherName, className as arrays of characters to store student's
name, father's name, and class respectively. - marks as an integer to store the marks obtained by the
student. - grade as a character to store the calculated grade.

Step 3: Input student's name, father's name, class, and marks.

Step 4: Determine the grade based on the marks: - If marks are greater than or equal to 90, assign
grade 'A'. - Else if marks are greater than or equal to 80, assign grade 'B'. - Else if marks are greater
than or equal to 70, assign grade 'C'. - Else if marks are greater than or equal to 60, assign grade 'D'. -
Else assign grade 'F'.

Step 5: Output student's name, father's name, class, marks, and grade.

Step 6: End.

PROGRAM # 8

#include <stdio.h>

int main() {

int number;

printf("Enter a number: ");

scanf("%d", &number);

if (number > 0)

printf("%d is positive.\n", number);

else if (number < 0)

printf("%d is negative.\n", number);

else

printf("The number is zero.\n");


return 0;

Algorithm

Step 1: Start

Step 2: Prompt the user to enter a number.

Step 3: Read the entered number.

Step 4: Check if the number is greater than 0. - If true, print "number is positive." - If false, proceed to
the next step.

Step 5: Check if the number is less than 0. - If true, print "number is negative." - If false, proceed to the
next step.

Step 6: If the number is not positive or negative, it must be zero, so print "The number is zero."

Step 7: End.

PROGRAM # 9

#include <stdio.h>

int main() {

int n, i;

int max, min, num;

// Input the number of elements

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

scanf("%d", &n);

// Input the first number

printf("Enter number 1: ");

scanf("%d", &num);
// Assume the first number as both max and min

max = min = num;

for (i = 2; i <= n; i++) {

printf("Enter number %d: ", i);

scanf("%d", &num)

if (num > max)

max = num;

if (num < min)

min = num;

// Output the maximum and minimum values

printf("Maximum value: %d\n", max);

printf("Minimum value: %d\n", min);

return 0;

Algorithm

Step 1: Start

Step 2: Prompt the user to input the number of elements.

Step 3: Prompt the user to input the first number.

Step 4: Assume the first number entered as both the maximum and minimum value

Step 5: Iterate through the remaining numbers from the second number to the total number of
elements.

Step 6: Inside the loop, prompt the user to input each subsequent number.

Step 7: Update the maximum value if the current number is greater than the current maximum.

Step 8 : Update the minimum value if the current number is smaller than the current minimum.

Step 9 : After all numbers have been input and processed, output the maximum and minimum values.
Step 10 : End the program.
PROGRAM # 10

#include <stdio.h>

int main() {

int num;

printf("Enter a number: ");

scanf("%d", &num);

if (num % 2 == 0) {

printf("%d is an even number.\n", num);

} else {

printf("%d is an odd number.\n", num);

return 0;

Algorithm

Step 1: Start

Step 2: Read the input number.

Step 3: Check if the input number is divisible by 2 (i.e., if the remainder of division by 2 is 0).

Step 4: If the remainder is 0, print that the number is even.

Step 5: If the remainder is not 0, print that the number is odd.

Step 6: End the program.


PROGRAM # 11

#include <stdio.h>

int main() {

int meterNumber;

char consumerName[50];

int unitsConsumed;

float totalBill = 0;

printf("Enter meter number: ");

scanf("%d", &meterNumber);

printf("Enter consumer name: ");

scanf("%s", consumerName);

printf("Enter units consumed: ");

scanf("%d", &unitsConsumed);

if (unitsConsumed <= 100) {

totalBill = unitsConsumed * 1.5; // Charge rate for first 100 units

} else if (unitsConsumed <= 200) {

totalBill = 100 * 1.5 + (unitsConsumed - 100) * 2.0; // Charge rate for next 100 units

} else {

totalBill = 100 * 1.5 + 100 * 2.0 + (unitsConsumed - 200) * 3.0; // Charge rate for units above 200

printf("\nUtility Bill\n");

printf("Meter Number: %d\n", meterNumber);

printf("Consumer Name: %s\n", consumerName);

printf("Units Consumed: %d\n", unitsConsumed);

printf("Total Bill Amount: $%.2f\n", totalBill);

return 0;

}
Algorithm

Step 1:Start

Step 2: Prompt the user to input the meter number.

Step 3: Read the meter number inputted by the user.

Step 4: Prompt the user to input the consumer name.

Step 5: Read the consumer name inputted by the user.

Step 6: Prompt the user to input the units consumed.

Step 7: Read the units consumed inputted by the user.

Step 8: Determine the total bill amount based on the units consumed: - If units consumed is less than or equal
to 100, multiply the units consumed by the charge rate for the first 100 units (1.5). - If units consumed is
greater than 100 and less than or equal to 200, calculate the bill by adding the charge for the first 100 units and
the charge for the remaining units (2.0 per unit). - If units consumed is greater than 200, calculate the bill by
adding the charge for the first 100 units, the charge for the next 100 units, and the charge for the remaining
units (3.0 per unit).

Step 9: Print the utility bill details including the meter number, consumer name, units consumed, and total bill
amount.

Step 10: End the program.

PROGRAM # 12

#include <stdio.h>

int isPrime(int num) {

if (num <= 1)

return 0;

for (int i = 2; i * i <= num; i++) {

if (num % i == 0)

return 0;
}

return 1;

int main() {

int number;

printf("Enter a number: ");

scanf("%d", &number);

if (isPrime(number))

printf("%d is a prime number.\n", number);

else

printf("%d is not a prime number.\n", number);

return 0;

Algorithm

Step 1: Start

Step 2: Define a function isPrime that takes an integer num as input and returns an integer.

Step 3: If num is less than or equal to 1, return 0 (indicating not prime).

Step 4: Iterate from i = 2 to i * i <= num.

Step 5: If num is divisible by i, return 0 (indicating not prime).

Step 6: If none of the conditions above are met, return 1 (indicating prime).

Step 7: Define the main function.

Step 8: Declare an integer variable number.

Step 9: Print "Enter a number: ".

Step 10: Read an integer from the user and store it in the variable number.

Step 11: If the result of calling isPrime function with number as argument is true (non-zero), print number is a
prime number.

Step 12: Otherwise, print number is not a prime number.


Step 13: End

PROGRAM # 13

#include <stdio.h>

int isPrime(int num) {

if (num <= 1)

return 0;

for (int i = 2; i * i <= num; i++) {

if (num % i == 0)

return 0;

return 1;

int main() {

int start, end;

printf("Enter the starting point: ");

scanf("%d", &start);

printf("Enter the ending point: ");

scanf("%d", &end);

printf("Even numbers: ");

for (int i = start; i <= end; i++) {

if (i % 2 == 0)

printf("%d ", i);

}
printf("\n");

printf("Odd numbers: ");

for (int i = start; i <= end; i++) {

if (i % 2 != 0)

printf("%d ", i);

printf("\n");

printf("Prime numbers: ");

for (int i = start; i <= end; i++) {

if (isPrime(i))

printf("%d ", i);

printf("\n");

return 0;

Algorithm

Step 1: Start

Step 2: Include the standard input/output library.

Step 3: Define a function isPrime that takes an integer num as input and returns an integer.

Step 4: If num is less than or equal to 1, return 0 (indicating not prime).

Step 5: Iterate from i = 2 to i * i <= num.

Step 6: If num is divisible by i, return 0 (indicating not prime).

Step 7: If none of the conditions above are met, return 1 (indicating prime).

Step 8: Define the main function.

Step 9: Declare integer variables start and end.

Step 10: Print "Enter the starting point: ".

Step 11: Read an integer from the user and store it in the variable start.
Step 12: Print "Enter the ending point: ".

Step 13: Read an integer from the user and store it in the variable end.

Step 14: Print "Even numbers: ".

Step 15: Iterate from i = start to end.

Step 16: If i is even, print i.

Step 17: Print a newline character.

Step 18: Print "Odd numbers: ".

Step 19: Iterate from i = start to end.

Step 20: If i is odd, print i.

Step 21: Print a newline character.

Step 22: Print "Prime numbers: ".

Step 23: Iterate from i = start to end.

Step 24: If i is prime (determined by calling isPrime function), print i.

Step 25: Print a newline character.

Step 26: End.

PROGRAM # 14

#include <stdio.h>

int main() {

int n;

float sum = 0;

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

scanf("%d", &n);

printf("Series: ");
for (int i = 1; i <= n; i++) {

printf("%d/%d ", i, i+1);

if (i != n)

printf("+ ");

sum += (float)i / (i + 1);

printf("\nSum of the series: %.2f\n", sum);

return 0;

Algorithm

Step 1: Start

Step 2: Declare integer variable n to store the number of terms and float variable sum to store the sum of the
series.

Step 3: Print "Enter the number of terms: ".

Step 4: Read an integer from the user and store it in the variable n.

Step 5: Print "Series: ".

Step 6: Iterate from i = 1 to n.

Step 7: Print i and i+1 separated by a '/' to represent each term of the series.

Step 8: If i is not equal to n, print '+ ' to separate terms in the series.

Step 9: Add (float)i / (i + 1) to sum.

Step 10: Print a newline character.

Step 11: Print "Sum of the series: " followed by the value of sum with 2 decimal places.

Step 12: End.

PROGRAM # 15
#include <stdio.h>

int main() {

int number, range;

printf("Enter the number: ");

scanf("%d", &number);

printf("Enter the range: ");

scanf("%d", &range);

printf("Table of %d up to %d:\n", number, range);

for (int i = 1; i <= range; i++) {

printf("%d x %d = %d\n", number, i, number * i);

return 0;

Algorithm

Step 1: Start

Step 2: Define the main function.

Step 3: Declare integer variables number and range to store user input.

Step 4: Print "Enter the number: ".

Step 5: Read an integer from the user and store it in the variable number.

Step 6: Print "Enter the range: ".

Step 7: Read an integer from the user and store it in the variable range.

Step 8: Print "Table of number up to range:".

Step 9: Iterate from i = 1 to range.

Step 10: Inside the loop, print " number x i = number * i".

Step 11: End loop.

Step 12: End.


PROGRAM # 16

#include <stdio.h>

int main() {

int number;

unsigned long long factorial = 1;

printf("Enter a number: ");

scanf("%d", &number);

if (number < 0) {

printf("Factorial of negative numbers is not defined.\n");

else {

for (int i = 1; i <= number; i++) {

factorial *= i;

printf("Factorial of %d = %llu\n", number, factorial);

return 0;

Algorithm

Step 1: Start

Step 2: Define the main function.


Step 3: Declare an integer variable number to store the user input and an unsigned long long variable factorial
to store the factorial result.

Step 4: Print "Enter a number: ".

Step 5: Read an integer from the user and store it in the variable number.

Step 6: If number is less than 0, print "Factorial of negative numbers is not defined." and exit the program.

Step 7: Otherwise, proceed to calculate the factorial.

Step 8: Initialize factorial to 1.

Step 9: Iterate from i = 1 to number.

Step 10: Multiply factorial by i in each iteration.

Step 11: Print the calculated factorial.

Step 12: End.

PROGRAM # 17

#include <stdio.h>

int main() {

int start, range, first = 0, second = 1, next;

printf("Enter the starting number: ");

scanf("%d", &start);

printf("Enter the range: ");

scanf("%d", &range);

printf("Fibonacci series starting from %d up to %d:\n", start, range);

printf("%d, %d, ", first, second);

while (first + second <= range) {

next = first + second;

if (next >= start)


printf("%d, ", next);

first = second;

second = next;

printf("\n");

return 0;

Algorithm

Step 1: Start

Step 2: Declare integer variables start, range, first set to 0, second set to 1, and next.

Step 3: Print "Enter the starting number: ".

Step 4: Read an integer from the user and store it in the variable start.

Step 5: Print "Enter the range: ".

Step 6: Read an integer from the user and store it in the variable range.

Step 7: Print "Fibonacci series starting from start up to range:".

Step 8: Print the first two numbers of the Fibonacci series, first and second.

Step 9: While the sum of first and second is less than or equal to range, do the following: - Calculate the next
Fibonacci number by adding first and second, and store it in next. - If next is greater than or equal to start, print
it. - Update first to the value of second. - Update second to the value of next.

Step 12: End loop.

Step 14: End.

You might also like