Techneical Proficiency
Techneical Proficiency
Techneical Proficiency
1
Program Name:- Write a C program to print 1D array.
Theory:-
· Arrays are used to store multiple values in a single variable, instead of
declaring separate variables for each value.
· To create an array, define the data type (like int) and specify the name of the
array followed by square brackets [].
· To insert values to it, use a comma-separated list inside curly braces, and
make sure all values are of the same data type
Program:-
#include <stdio.h>
int main() {
return 0;
Output:
The elements of the array are:
10 20 30 40 50
Experiment no.2
Program Name:- Write a 2D program in C.
Theory:-
· A 2D array is also known as a matrix (a table of rows and columns).
· A multi-dimensional array can be defined as an array that has more than one
dimension.
· Having more than one dimension means that it can grow in multiple
directions. Some popular multidimensional arrays are 2D arrays and 3D
arrays.
Program:-
#include <stdio.h>
int main() {
int matrix[3][4] = {
{1, 2, 3, 4},
{5, 6, 7, 8},
};
}
return 0;
Output:-
{
{1, 2, 3, 4},
{5, 6, 7, 8},
Experiment no.3
Program Name:- Write a program of Pointer in C
· Pointers in C are variables that store the memory address of another variable.
Pointers are essential for dynamic memory management and for creating more
efficient code that manipulates variables indirectly
Program:-
#include <stdio.h>
int main() {
int a = 10;
int b = 20;
ptr = &a;
printf("The value of a is: %d\n", *ptr); // Dereferencing the pointer to get the value of 'a'
printf("The value of b is: %d\n", *ptr); // Dereferencing the pointer to get the value of 'b'
*ptr = 30; // Dereferencing 'ptr' to change 'b' to 30 (since ptr now points to b)
printf("The new value of b is: %d\n", b); // Prints 30, as we modified 'b' through the pointer
return 0;
Output:-
The value of a is: 10
Experiment no.4
Program Name:- Write a program C program for implementation of
FCFC.
Theory:-
Program:-
#include <stdio.h>
wt[0] = 0;
wt[i] = bt[i - 1] + wt[i - 1]; // Waiting time is previous process's burst time + waiting time
void findTurnAroundTime(int processes[], int n, int bt[], int wt[], int tat[]) {
total_tat += tat[i];
int main() {
int n;
scanf("%d", &n);
scanf("%d", &burst_time[i]);
findAverageTime(processes, n, burst_time);
return 0;
Output:-
Enter the number of processes: 3
Process 1: 5
Process 2: 8
Process 3: 3
1 5 0 5
2 8 5 13
3 3 13 16
Experiment no.5
Program Name:- Write a program to compare two Strings in C.
Theory:-
· To compare two strings in C, we can use the built-in function strcmp() (from
the string.h library) or write our own logic to compare each character of both
strings manually. Below is a C program that demonstrates both methods.
Program:-
#include <stdio.h>
#include <string.h>
int main() {
if (strcmp(str1, str2) == 0) {
} else {
return 0;
Output:-
Output 2:-
Experiment no.6
Program Name:- Write a program to Find Length of the String in C.
Theory:-
· In C, you can find the length of a string using the standard library function
strlen(), or you can manually calculate the length by iterating through the
string. Below is a program that demonstrates both methods.
· The strlen() function from the string.h library returns the number of characters
in the string excluding the null terminator (\0).
Program:-
#include <stdio.h>
#include <string.h>
int main() {
char str[100];
// Input a string
gets(str); // gets() is used for input, though not safe in production code
return 0;
}
Output:-
Experiment no.7
Program Name:- Write a program to copy the String in C.
Theory:-
· To copy a string in C, you can either use the built-in strcpy() function from the
string.h library or write your own function to manually copy the characters
from one string to another.
· Here’s how you can implement both approaches.
Program:-
#include <stdio.h>
#include <string.h>
int main() {
// Input a string
gets(str1); // gets() is used for input, though not safe in production code
strcpy(str2, str1);
// Output the copied string
return 0;
Output:-
Enter the string: Hello, World!
Experiment no.8
Program Name:- Write a structure function in C.
Theory:-
Structures
· Structures (also called structs) are a way to group several related variables
into one place. Each variable in the structure is known as a member of the
structure.
· Unlike an array, a structure can contain many different data types (int, float,
char, etc.).
#include <stdio.h>
struct myStructure {
int myNum;
char myLetter;
};
int main() {
s1.myNum = 13;
s1.myLetter = 'B';
// Print values
return 0;
Output:-
My number: 13
My letter: B
Experiment no.9
Program Name:- Write a program of Round Robin in C.
Theory:-
Program:-
#include <stdio.h>
#define MAX_PROCESSES 10
typedef struct {
int processID;
int burstTime;
int remainingTime;
} Process;
int time = 0;
int completed = 0;
if (processes[i].remainingTime > 0) {
time += processes[i].remainingTime;
processes[i].remainingTime = 0;
completed++;
} else {
time += quantum;
processes[i].remainingTime -= quantum;
}
}
int main() {
Process processes[MAX_PROCESSES];
scanf("%d", &numProcesses);
processes[i].processID = i + 1;
scanf("%d", &processes[i].burstTime);
processes[i].remainingTime = processes[i].burstTime;
scanf("%d", &quantum);
return 0;
Output:-
Enter the number of processes: 3
Experiment no.10
Program Name:- Write a program of Linkedlist in C.
Theory:-
· A linked list is a linear data structure where each element, known as a node, is
connected to the next one using pointers. Unlike array, elements of linked list
are stored in random memory locations.
A linked list is a sequence of nodes where each node contains two parts:
Program:-
#include <stdio.h>
#include <stdlib.h>
int data;
} Node;
// Function to create a new node
newNode->data = data;
newNode->next = NULL;
return newNode;
if (*head == NULL) {
*head = newNode;
} else {
temp = temp->next;
temp->next = newNode;
*head = temp->next;
free(temp);
return;
prev = temp;
temp = temp->next;
prev->next = temp->next;
free(temp);
temp = temp->next;
printf("NULL\n");
int main() {
insertNode(&head, 20);
insertNode(&head, 30);
printList(head);
deleteNode(&head, 20);
printList(head);
return 0;
Output:-