1 / 2
Apr 2018

#include
#include <stdio.h>

using namespace std;
int prime(int n)
{
int i=2,flag=1;
while(i<n)
{
if(n%i==0)
{
flag==1;
break;
}
i=i+1;
}
if(flag==0)
{
return n;
}
}
int main()
{
int high,low,prm,t,x=1;
scanf("%d",&t);

while(t<=x)
{
	scanf("%d,%d",&low,&high);
	while(low<=high)
{
	prm=prime(low);
	printf("%d",prm);
	low=low+1;
}
t=t+1;
}

}
Input:
2
1 10
3 5
but
Output:

is blank. Where am i going wrong?

  • created

    Apr '18
  • last reply

    Apr '18
  • 1

    reply

  • 729

    views

  • 2

    users

You should find this yourself. Try these, and spot the difference.

1
1 10

2
1 10
3 5

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 17 11d

Want to read more? Browse other topics in C and C++ or view latest topics.