Practice Programs For Array
Practice Programs For Array
programmerdouts.blogspot.com/2019/06/practice-programs-for-array-in-c.html
Practice Programs
Doing Programs gives you the great understanding about what you
have learned.
Doing Programs gives you the Confidence.
So let's Start by doing some programming.
#include<stdio.h>
void main()
{
int marks[15]={63,65,48,95,45,48,78,65,23,78,78};
int i,sums=0; //initialization of sums variable to zero,
float mean; // because it should not start with any garbage value.
for(i=0;i<11;i++)
{
sums = sums + marks[i]; //at every iteration assigning (current value +
new_element) to new sums variable
}
mean = sums/11;
Output:
Mean of marks array is 62.0000
void main()
{
int i,n;
int arr[20];
printf("enter the number of elements:");
scanf("%d",&n);
Output:
2/6
Q:Declare a integer array and take no of elements and their value
from the user, and print the maximum value?
Solution:
#include<stdio.h>
void main()
{
int i, n, maxs=0;
int arr[20];
printf("enter the number of elements:");
scanf("%d",&n);
Output:
60 is a maximum value.
Exercise:
3/6
Q:Declare a integer array and take no of elements and their value
from the user,and print the minimum value?
4/6
#include<stdio.h>
void main()
{ int i,j;
int array1[3][3] = {{1,2,3},
{4,5,6}, //decleration and initializing the 2-d array
{7,8,9}};
int result[3][3];
Output:
Addition of two matrix is :
12 14 16
18 20 22
24 26 28
5/6
Exercise:
Q:Declare 2-dimensnional integer arrays and initialize them with
some value and do their Subtraction and assign that result to
another 2-dimensional array?
Further Topics:
Strings In C
What are Strings
Concept of strings
Input And Output Functions
How to take strings As Input
What is gets() functions
What is puts() functions
2D Strings
Concept of 2D Strings
What is Character array
what are various string handling functions
Functions for Characters
Functions from #include<string.h> Header File
what are strcpy(), strcmp(), strncmp(), strcmpi(),etc
strcmp() VS strncmp() VS strcmpi()
Functions from #include<ctype.h> Header File
what are isdigit(), islower() , isupper(),etc
Various Practice Programs on strings
6/6