declare an array of type unsigned int called values with five elements and initialize the elements to the even integers from 2 to 10. Assume that the symbolic constant SIZE has been defined as 5
Program:
#include <stdio.h>
#define SIZE 5
int main()
{
unsigned int a[SIZE],n;
for(int i=2;i<=10;i++)
{
if(i%2==0)
{
a[n] = i;
n++;
}
}
printf("Elements in Array:\n");
for(int i=0;i<SIZE;i++)
{
printf("%d \t",a[i]);
}
return 0;
}
Screenshots:
Output:
Get Answers For Free
Most questions answered within 1 hours.