write a program to input 10 numbers in an array and shift the prime numbers to the beginning of the array and composite numbers at the end of the array without changing the order
Answers
Answered by
0
Practice Write an Article .... Find minimum number to be inserted in array, so that sum of all elements of array ... insert in array so their sum is prime ... number is prime or not.
Answered by
0
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[10],b[10]i,;
cout<<"enter 10 natural numbers";
for(i=0;i<10;i++)
{
cin>>a[i];
}
for(i=0;i<10;I++)
{
for(int j=1,k=0;j<=3,k<10;j++,k++)
{
if(a[i]%j!=0)
{
b[k]=a[i];
}
else
b[10-k]=a[i];
}
}
for(i=0;i<10;i++)
{
cout<<a[i];
}
getch();
}
i hope it will help u..
please mark aS BRainleist...
Similar questions