Hi, I'm new at C Programming. I need to find even numbers that are inserted by the user then to select the numbers which can be diveded by 6 and then to multiply those numbers.
As you can see I need to multiply 12 and 18, but i dont know how. ( Sorry for a foreign language in the image). Can someone tell me how?
Code:
#include <stdio.h>
int main()
{
int a[50], i, n, p;
// Vector size
printf("Introduceti marimea vectorului:\n");
scanf ("%d", &n);
printf("\n");
// Elements added by the user
printf("Introduceti valorile elementelor:\n");
for (i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
printf("\n");
// Even numbers
printf("Numerele pare din vector sunt:\n\n");
for (i=0; i<n; i++)
{
if (a[i] % 2 == 0)
{
printf("%d\t", a[i]);
}
}
// Even numbers that can be divided by 6 ( + i need to multiply those numbers)
printf("\n\nNumerele pare care se impart la 6 fara rest sunt:\n\n");
for (i=0; i<n; i++)
{
if (a[i] % 6 == 0)
{
printf("%d\t", a[i]);
}
}
printf("\n\n\n");
return 0;
}
p.s. And I am sorry for my english. Have a nice day!