PPS LAB

Program to find average of elements of a 2D array

Program #include <stdio.h> int main() { printf(“****************************************************”); printf(“\n****************************************************”); printf(“\n** WAP to find average of elements of a 2D array **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n****************************************************”); printf(“\n****************************************************\n”); int m, n, i, j, a[5][5]; float avg, sum = 0; printf(“Enter no. of rows and columns in the …

Program to find average of elements of a 2D array Read More »

Program to find sum of elements of a 2D array

Program #include <stdio.h> int main() { printf(“****************************************************”); printf(“\n****************************************************”); printf(“\n** WAP to find sum of elements of a 2D array **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n****************************************************”); printf(“\n****************************************************\n”); int m, n, i, j, a[5][5],sum=0; printf(“Enter no. of rows and columns in the array\n”); scanf(“%d%d”, &m, &n); printf(“enter …

Program to find sum of elements of a 2D array Read More »

Program to enter and display elements of a 2D array

Program #include <stdio.h> int main() { printf(“****************************************************”); printf(“\n****************************************************”); printf(“\n** WAP to enter and display a 2D array **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n****************************************************”); printf(“\n****************************************************\n”); int m, n, i, j, a[5][5]; printf(“Enter no. of rows and columns in the array\n”); scanf(“%d%d”, &m, &n); printf(“enter array elements”); …

Program to enter and display elements of a 2D array Read More »

Program to sort the elements of an array using insertion sort

ProgramTime Complexity: O(n2) #include <stdio.h> int main() { printf(“***************************************************************”); printf(“\n***************************************************************”); printf(“\n** WAP to sort the elements of an array using insertion sort **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n***************************************************************”); printf(“\n***************************************************************\n”); int a[10],n,i,j,key; printf(“enter the no. of elements in array”); scanf(“%d”,&n); printf(“enter array elements”); for(i=0;i<n;i++) scanf(“%d”,&a[i]); for(i=1;i<n;i++) …

Program to sort the elements of an array using insertion sort Read More »

Program to sort the elements of an array using bubble sort

Program Time Complexity: O(n2) #include <stdio.h> int main() { printf(“***************************************************************”); printf(“\n***************************************************************”); printf(“\n** WAP to sort the elements of an array using bubble sort **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n***************************************************************”); printf(“\n***************************************************************\n”); int a[10],n,i,j,temp; printf(“enter the no. of elements in array”); scanf(“%d”,&n); printf(“enter array elements”); for(i=0;i<n;i++) scanf(“%d”,&a[i]); …

Program to sort the elements of an array using bubble sort Read More »

WAP to explain Call by Value Method of Function Call

Program #include <stdio.h> void change(int a, int b) { int t=a; a = b; b = a; printf(“\nIn the Function Values are changed”); printf(“\na= %d and b= %d”, a, b); } int main() { printf(“***************************************************************”); printf(“\n***************************************************************”); printf(“\n** WAP to explain Call by Value Method **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); …

WAP to explain Call by Value Method of Function Call Read More »

Program to find average of elements of an array

Program #include <stdio.h> int main() { printf(“************************************************************”); printf(“\n************************************************************”); printf(“\n** WAP to find average of elements of an array **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n************************************************************”); printf(“\n************************************************************\n”); int n,i,a[5]; float sum=0,avg; printf(“Enter no. of elements in the arrayn”); scanf(“%d”,&n); printf(“enter array elements”); for(i=0;i<n;i++) scanf(“%d”,&a[i]); for(i=0; i<n; i++) …

Program to find average of elements of an array Read More »

Program to find product of elements of an array

Program #include <stdio.h> int main() { printf(“***********************************************************”); printf(“\n************************************************************”); printf(“\n** WAP to find Product of elements of an array **”); printf(“\n** Created by Sheetal Garg **”); printf(“\n** Assistant Professor **”); printf(“\n** Phone No:9467863365 **”); printf(“\n************************************************************”); printf(“\n************************************************************\n”); int n,i,a[5],prod=1; printf(“Enter no. of elements in the arrayn”); scanf(“%d”,&n); printf(“enter array elements”); for(i=0;i<n;i++) scanf(“%d”,&a[i]); for(i=0; i<n; i++) prod=prod * …

Program to find product of elements of an array Read More »

error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.