Write a program in c which will print even numbers from a given array
#include<stdio.h>
#include<conio.h>
main()
{
int a[100],i,n;
printf("\n\tIT'S A PROGRAM TO FIND EVEN NUMBERS FROM A GIVEN ARRAY\n");
printf("\n\tEnter the array size: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\nEnter the %d value: ",i);
scanf("%d",&a[i]);
}
{
printf("\n\tThe even numbers are: ");
for(i=1;i<=n;i++)
if(a[i]%2==0)
{
printf("%d ",a[i]);
}
}
}
#include<stdio.h>
#include<conio.h>
main()
{
int a[100],i,n;
printf("\n\tIT'S A PROGRAM TO FIND EVEN NUMBERS FROM A GIVEN ARRAY\n");
printf("\n\tEnter the array size: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\nEnter the %d value: ",i);
scanf("%d",&a[i]);
}
{
printf("\n\tThe even numbers are: ");
for(i=1;i<=n;i++)
if(a[i]%2==0)
{
printf("%d ",a[i]);
}
}
}
No comments:
Post a Comment