Write a program to enter any 50 numbers and check whether they are divisible by 5 or not. If divisible then perform the following tasks: (a) Display all the numbers ending with the digit 5. (b) Count those numbers ending with 0 (zero).
Answers
Answered by
11
Answer:
#include <stdio.h>
int main ()
{
int nums[50], count = 0;
printf ("please enter 50 numbers\n");
for (int i = 0; i < 50; i++)
{
scanf ("%d", &nums[i]);
}
printf ("numbers ending with 5 :\n");
for (int j = 0; j < 50; j++)
{
if (nums[j] % 10 == 5)
{
printf ("%d\t", nums[j]);
}
}
for (int k = 0; k < 50; k++)
{
if (nums[k] % 10 == 0)
{
count++;
}
}
printf ("\nnumbers ending with 0 = %d", count);
return 0;
}
Similar questions