Professional Documents
Culture Documents
Clifton Campus
Practical File
Grade X
Topics: Programming in C
Algorithms (Pseudocode & Flowchart)
Spreadsheets(MS Excel)
CERTIFICATE
This is to certify that Mr./Miss. of class has
carried out the necessary practical prescribed by the Agha Khan
University Examination Board of the year 2022-23.
_____________________ ____________________
Programming
1 To find the volume of a cube, cylinder, or sphere
9 To find the acceleration of a moving object with a given mass and the force applied
10 To find even numbers in integers ranging from n1 and n2 (where n1 is greater than n2)
Index
Office Automation II: Spreadsheets(MS Excel)
1 Prepare a spreadsheet by naming cells and sheets.
2 Use different options of paste special, i.e. value, format and formula.
3 Print a spreadsheet.
4 Apply cell formatting tools like; number, alignment, font, border, fill.
5 Apply different functions to the data, i.e sum, average, count, minimum and maximum.
6 Insert a pie chart and bar graph in the data sheet.
7 Apply filter and data validation on spreadsheet data.
8 Protect a worksheet.
9 Lock/ unlock cells of spreadsheet.
1. To find the volume of a cube, cylinder, or sphere
#include <stdio.h>
#include <math.h>
int main() {
int shape;
float side, radius, height, volume;
const float PI = 3.14159;
printf("Enter the shape (1 for cube, 2 for cylinder, 3 for sphere): ");
scanf("%d", &shape);
switch(shape) {
case 1:
printf("Enter the length of one side of the cube: ");
scanf("%f", &side);
volume = pow(side, 3);
printf("The volume of the cube is %.2f cubic units.\n", volume);
break;
case 2:
printf("Enter the radius and height of the cylinder: ");
scanf("%f %f", &radius, &height);
volume = PI * pow(radius, 2) * height;
printf("The volume of the cylinder is %.2f cubic units.\n", volume);
break;
case 3:
printf("Enter the radius of the sphere: ");
scanf("%f", &radius);
volume = (4.0/3.0) * PI * pow(radius, 3);
printf("The volume of the sphere is %.2f cubic units.\n", volume);
break;
default:
printf("Invalid input.\n");
}
return 0;
}
2. To find the area of a triangle, parallelogram, rhombus, and
trapezoid
#include <stdio.h>
int main() {
int choice;
float base, height, side1, side2, diag1, diag2, height2, sob;
switch(choice) {
case 1:
printf("Enter the base and height of the triangle: ");
scanf("%f %f", &base, &height);
printf("Area of the triangle is: %.2f\n", 0.5 * base * height);
break;
case 2:
printf("Enter the base and height of the parallelogram: ");
scanf("%f %f", &base, &height);
printf("Area of the parallelogram is: %.2f\n", base * height);
break;
case 3:
printf("Enter the diagonal1, diagonal2 of the rhombus: ");
scanf("%f %f", &diag1, &diag2);
printf("Area of the rhombus is: %.2f\n", 0.5 * diag1 * diag2);
break;
case 4:
printf("Enter the sum of bases and height of the trapezoid: ");
scanf("%f %f", &sob, &height2);
printf("Area of the trapezoid is: %.2f\n", 0.5 * (sob) * height2);
break;
default:
printf("Invalid choice.\n");
break;
}
return 0;
}
10. To find even numbers in integers ranging from n1 and n2 (where
n1 is greater than n2)
#include <stdio.h>
int main() {
int n1, n2, i;
return 0;
}
11- To determine prime numbers in integers ranging from n1 to n2
(where n1 is greater than n2)
#include <stdio.h>
int main() {
int n1, n2, i, j, is_prime;
printf("Enter two integers (n1 > n2): ");
scanf("%d %d", &n1, &n2);
printf("Prime numbers between %d and %d are: \n", n2, n1);
for (i = n2; i <= n1; i++) {
is_prime = 1;
for (j = 2; j <= i / 2; j++) {
if (i % j == 0) {
is_prime = 0;
break;
}
}
if (is_prime && i > 1) {
printf("%d ", i);
}
}
printf("\n");
return 0;
}
12. To count multiple of a given number lying between two numbers
#include <stdio.h>
# include <conio.h>
main()
{
int i, n, d ;
int main()
{
int num,x,max;
max=0;
if (num>max)
max=num;
}
return 0;
}
14.To find the minimum number from input values.
#include<stdio.h>
#include<conio.h>
int main()
{
int num,x,min;
min=9999;
if (num<min)
min=num;
}
printf("The minimum number is %d",min);
return 0;
}
15- To determine whether a given number is prime or not
#include <stdio.h>
#include <conio.h>
main() {
int n, i, c = 0;
printf("Enter any number n:");
scanf("%d", &n);
//logic
for (i = 1; i <= n; i++) {
if (n % i == 0) {
c++;
}
}
if (c == 2) {
printf("%d is a Prime number",n);
}
else {
printf("%d is not a Prime number",n);
}
getch();
}
18- To find the sequence of odd numbers starting from a given number
#include <stdio.h>
int main() {
int startNum, i;
printf("Enter the starting number: ");
scanf("%d", &startNum);
for (i=startNum;i<=startNum+10;i++)
{
if (i%2==1)
printf("%d ",i);
}
return 0;
}
To calculate the exponent of a given number
#include <stdio.h>
#include <math.h>
int main ()
{
int main ()
{
int Num1, Num2, i, GCD;
#include <stdio.h>
#include <conio.h>
int main()
{
int n, i = 3, count, c;
printf("Enter the number of prime numbers to print\n");
scanf("%d", &n);
if (n >= 1) {
printf("First %d prime numbers are:\n",n);
printf("2\n");
}
for (count = 2; count <= n;)
{
for (c = 2; c <= i - 1; c++)
{
if (i%c == 0)
break;
}
if (c == i)
{
printf("%d\n", i);
count++;
}
i++;
}
return 0;
}
To count multiple of a given number lying between two numbers
#include <stdio.h>
# include <conio.h>
main()
{
int i, n, d ;
ALGORITHM
Step 1
Take input for the limit (n) and a number (d).
Step 2
Use a for loop to iterate from 1 to n.
Step 3
Inside the loop, check if the current value of i is divisible by d (i % d == 0).
Step 4
If it is divisible, print the value of i.
Step 5
Repeat steps 3 and 4 until all values in the range have been checked.
Step 6
End the program.