Saturday, 18 October 2014

Write a program that reads 10 numbers from the user into an arrays and tells how many of them are multiples of n (user will tell the value of n)

Leave a Comment
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
int n=0,temp=0,counter=0;
double value[10];
for(int i=0;i<10;i++)
{
cout<<"Enter index of array "<<i<<" = ";
cin>>value[i];
}
cout<<"Enter N = ";
cin>>n;
for(int b=0;b<10;b++)
{
temp=value[b];
if(n*n==temp)
counter++;
}
cout<<"The Total Multiple of "<<n<<" is = "<<counter;
getch();
}
Output:-

If You Enjoyed This, Take 5 Seconds To Share It