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 |
program to print upper & lower triangle of a matrix
what is the output of printf("%d",(scanf("%d",10));
What is the diffrent between while and do while statement ?
What is else if ladder?
How many parameters should a function have?
What is a char in c?
enum DAY { sunday, monday, tuesday }; enum EDAYS { friday, saturday, sunday }; void main() { int i =0; if( i == sunday) { printf("%d",i); } } what would be the output?
Can a void pointer point to a function?
proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
give an example of type casting by a simple c program
which is an algorithm for sorting in a growing Lexicographic order
How do you print only part of a string?