I have an array of 100 elements, each of which is a random
integer. I want to know which of the elements:
a) are multiples of 2
b) are multiples of 2 AND 5
c) have a remainder of 3 when divided by 7
Answer / ruchi
#include<stdio.h>
#include<conio.h>
void main()
{
int num[100],n,i;
clrscr();
printf("\nEnter the number of elements ");
scanf("%d",&n);
printf("\nEnter the number ");
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
}
for(i=0;i<n;i++)
{
if(num[i]%2==0)
{
printf("\nThe Number %d is multiple of 2 ",num[i]);
}
if((num[i]%2==0)&&(num[i]%5==0))
{
printf("\nThe Nubmer %d is the multiple of both 2 and 5
",num[i]);
}
if(num[i]%7==3)
{
printf("\nThe number %d has remainder 7 ",num[i]);
}
}
getch();
}
Is This Answer Correct ? | 1 Yes | 0 No |
what is disadvantage of pointer in C
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
Explain what is meant by high-order and low-order bytes?
What is the difference between array and structure in c?
What is boolean in c?
What is a 'null pointer assignment' error?
Differentiate between full, complete & perfect binary trees.
How we add our function in liabrary as liabrary function. Exp. we want use our int factorical(int); function as int pow(int,int); function working in math header file.
How can I call a function with an argument list built up at run time?
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?
What is a node in c?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??