Thursday, 15 August 2013

C programming arrays assistance?

C programming arrays assistance?

Write c program where the user takes an array with n elements and finds
the elements whose value is a multiple of the number 5.These elements are
displays on screen along with their value like this : V[i]=a ,V[j] =
b,.... My code :
#include <stdio.h>
int main ()
{
int n,i,sh=0;
int v[100];
printf ("Please write n:");
scanf("%d",&n);
for (i=0;i<n;i++)
{ printf ("\n Write the element %d",i);
scanf("%d",&v[i]);
}
if (v[i] %5)
printf("The element is a multiple of 5",&sh);
return 0;
}
It compiles perfectly,but when I run this and I write the elements,it does
nothing..where am I wrong?

No comments:

Post a Comment