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 the use of header files?
What is %s and %d in c?
What is a far pointer?What is the utility?
What is meant by global static? why we have to use static variable instead of Global variable
wats the diference btwen constant pointer and pointer to a constant.pls give examples.
what will be the output for the following main() { printf("hi" "hello"); }
do ne body have any idea about the salary for the we r going to have interview. yup .. u got it right ..i m talking abt NIC.
write a program for fibonaci series by using while loop in c?
Is null equal to 0 in sql?
what does the following function print? func(int i) { if(i%2)return 0; eale return 1; } main() { int =3; i=func(i); i=func(i); printf("%d",i);}
What are the types of functions in c?
What does malloc () calloc () realloc () free () do?