#include
#include
int evensum(int []);
void main()
{
int no[5], i, total;
clrscr();
for(i=1;i<=5;i++)
{
printf("\n\t Enter number ::");
scanf("%d",&no[i]);
}
total=addition(no);
printf("\n\t Total :: %d",total);
getch();
}

int addition(int n[])
{
int i, total=0;
for(i=1;i<=5;i++)
{
if(n[i]%2==0)
{
total=total+n[i];
}
}
return (total);
}

C Program to find sum of even numbers using array of 10 elements and array

#include”stdio.h”
#include”conio.h”
int evensum(int []);
void main()
{
int no[10], i, total;
clrscr();
for(i=1;i<=10;i++)
{
printf("\n\t Enter number ::");
scanf("%d",&no[i]);
}
total=evensum(no);
printf("\n\t Sum of even no :: %d",total);
getch();
}

int evensum(int n[])
{
int i, addition=0;
for(i=1;i<=10;i++)
{
if(n[i]%2==0)
{
addition=addition+n[i];
}
}
return (addition);
}

C Program for Addition using Call by Address

#include”stdio.h”
#include”conio.h”
int addition(int *, int *);
void main()
{
int n1, n2, total;
clrscr();
printf(“\n\t Enter two numbers ::”);
scanf(“%d%d”,&n1,&n2);
total=addition(&n1,&n2);
printf(“\n\t Total = %d”,total);
getch();
}

int addition(int *no1, int *no2)
{
int sum;
sum=*no1+*no2;
return sum;
}

C Program to find perimeter of square using with parameter, with return type

#include”stdio.h”
#include”conio.h”
int perimeter(int);
void main()
{
int n, result;
clrscr();
printf(“Enter side of square:”);
scanf(“%d”,&n);
result=perimeter(n);
printf(“Perimeter = %d”,result);
getch();
}

int perimeter(int p)
{
return (p*4);
}