Lab Index - Grade XII

Lab works-1(Functions)
1. Write C program to find area and perimeter of a rectangle. Use function area_perimeter().
#include <stdio.h>
2. Write C program to know a number is even or odd using function named even_odd().
#include <stdio.h>
3. Write C program to know a number is positive or negative or zero using function. Assume yourself function name.
#include <stdio.h>
4. Write C program to calculate factorial value of a number using function facto().
#include <stdio.h>
5. Write C program to print multiplication table of a number using function table().
#include <stdio.h>
6. Write C program to know a number is prime or not. Take the function name yourself.
#include <stdio.h>
7. Write C program to print Fibonacci series 1,1,2,3,5,8… nth terms. Assume function name yourself.
#include <stdio.h>
8. Write C program to print the greatest value among three numbers using a function intgreat().
#include <stdio.h>
9. Write C program to find sum of series 1,2, 3,…..200 using function.
#include <stdio.h> Assume yourself function name. It returns a floating value.
#include <stdio.h>
10. Write C program to reverse a number. Use function.
#include <stdio.h>
11. Write C program to input elements of an array and print them with their sum. Suppose, the array is one dimensional & is of float type and function to be used is array_elements().
#include <stdio.h>
12. Suppose a function string_length(char st[]).Here, we have passed string as parameter. Use this function to find the length of string which must return the value.
#include <stdio.h>
13. Use a function to print a string in lowercase. Pass string as parameter.
#include <stdio.h>
14. Suppose a function void array_transpose(int a[][]).Here, we have passed array as parameter. Use this function to find transpose of array.
#include <stdio.h>
15. Suppose a function void matrix_sum(int a[][],int b[][]).Here, we have passed array as parameter. Use this function to find sum of matrices.
#include <stdio.h>
16. An array of size 20 contains some elements. Now, Write C program to count total positive and negative elementsstored in that array using a function void pos_neg(). Pass that array as parameter from main function.
#include <stdio.h>
17. Write C program to find maximum value among ten numbers stored in an array. We have to use function intmax(int a[]).
#include <stdio.h>
18. An array contains some numbers(integer type).Write C program to sort numbers using a function void sort(a[]).We have to pass that array from main function.
#include <stdio.h>
19. Write C program to check a number is Armstrong or not using a function armstrong(). It returns a value. Pass that number as a parameter.
#include <stdio.h>
20. Write C program to find factorial value of a number using recursive function.
#include <stdio.h>
21. Write C program to print Fibonacci series 1,1,2,3 … 100 using recursive function.
#include <stdio.h>
22. Write C program to show concept of local/automatic variables. Use function.
#include <stdio.h>
23. Write C program to show concept of global/external variables. Use function.
#include <stdio.h>
24. How would you use function with static variables.Write C program for this.
#include <stdio.h>
25. Write C program to show concept of register variable.
#include <stdio.h>
Case study Write C program to perform following operations depending upon user’s choice. Use different function for these operations. 1. To find maximum and minimum value stored in a list 2. To print prime number between 1 and 100 3. To accept a string and convert that into toggle case(alternate small and capital letters) 4. Exit Use switch… case structure
Lab No. 1 Date: 2079-03-20 Lab Task:
1. Write C program to calculate area of rectangle. 2. Write C program to simple interest. Click here for code
Lab No. 2 || Date: 2079-03-21
1. Write C program to check whether the given number is odd or even.
#include <stdio.h> int main() { int num,rem; printf(" Enter any number : "); scanf("%d",&num); rem=num%2; if(rem==0) printf(" Given number is even"); else printf("Given number is odd."); return 0; }
2. Write C program to find middle number among three different numbers.
#include<stdio.h> int main() { int num1,num2,num3; printf("Enter three numbers"); scanf("%d%d%d",&num1,&num2,&num3); if(num1>num2&&num1<num3||num1<num2&&num1>num3) printf("%d is middle number",num1); else if(num2>num1&&num2<num3||num2<num1&&num2>num3) printf("%d is middle number",num2); else printf("%d is middle number",num3); return 0; }
Lab No.
Date: 2078-07-22

Lab Task:

[Programming in C-II]
  1. Write C program to input roll_no,fname and lname of 5 students and display the same records.[Book page : 201]
  2. Write C program that takes roll_no, fname, lname of 5 students and prints the same records in ascending order on the basis of roll_no.[Book page: 202]




Lab No.
Date: 2078-07-22

Lab Task:

[Programming in C-II]
  1. Write C program to input roll_no,fname and lname of 5 students and display the same records.[Book page : 201]
  2. Write C program that takes roll_no, fname, lname of 5 students and prints the same records in ascending order on the basis of roll_no.[Book page: 202]




Lab No.
Date: 2078-07-23

Lab Task:

[Programming in C-II]
  1. Write a program that takes name and marks of 10 students. Sort data according to marks in descending order and display them




Lab No.
Date: 2078-07-25

Lab Task:

[Programming in C-II]
  1. Write a program using function to calculate sum of two distances and distance is measured in terms of feet and inch.[Book page : 203]




Lab No.
Date: 2078-08-01

Lab Task:

[SQL] SQL Lab Exercise-1 [Book page : 33]

1. Click on XAMPP server 2. Start Apache and MySQL 3. Click On Admin of MySQL 4. Click on SQL of localhost/phpMyAdmin Type Following codes: create database Lab01; 5. Click on database and select the database which you have created. 6. Click on SQL and type the code to create table.

Lab No.
Date: 2078-08-10

Lab Task:

[SQL] SQL Lab Exercise-2 [Book page : 33]



Lab No. 6 Date: 2078-12-24 Lab Task:
Practical Exam Mock Test 2078 Q1. Write C Program to sort ten integer numbers in ascending order. Click here for code
Lab No. Date: 2078-12-25 Lab Task:
Practical Exam Mock Test 2078 Q2. Write C Program to create a data file named "student.txt" and store data under fields name, class and mark in computer. Progam should terminate according to user's choice. After that display them. Click here for code