1D_2D Array Program with Problem Statement
1D_2D Array Program with Problem Statement
Subject:PPS
Problem Statement:
Write a C program that allows the user to input elements into a 1D array and then display those elements.
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
int arr[n];
scanf("%d", &arr[i]);
return 0;
}
Problem Statement:
Write a C program that allows the user to input elements into a 2D array and then display those elements.
#include <stdio.h>
int main() {
printf("Enter the number of rows and columns for the 2D array: ");
int arr[rows][cols];
scanf("%d", &arr[i][j]);
printf("\n");
}
return 0;
Problem Statement:
Write a C program that allows the user to input elements into a 1D array and perform basic operations
such as finding the sum and average of the elements.
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
int arr[n];
int sum = 0;
scanf("%d", &arr[i]);
sum += arr[i];
return 0;
Problem Statement:
Write a C program that allows the user to input elements into a 2D array and perform basic operations
such as finding the sum and average of the elements in each row.
#include <stdio.h>
int main() {
printf("Enter the number of rows and columns for the 2D array: ");
int arr[rows][cols];
scanf("%d", &arr[i][j]);
printf("\n");
int rowSum = 0;
rowSum += arr[i][j];
return 0;