all the programs are double checked in this site and they are working in visual studio...
#include<iostream>
using namespace std;
int  main()
{
 int i,j,f;
 cout<<"Prime numbers between 1 to 100 are:\n\n";
 for(i=2;i<=100;i++)
 {
  f=0;
  for(j=2;j<i;j++)
  {
   if(i%j==0)
   {
    f=1;
    break;
   }
  }
  if(f==0)
   cout<<i<<" ";
  }
 system("pause");
 return 0;
}
 
what is f?
ReplyDeleteim sorry im beginner
F is the integer used here. Like j and i..i and j is compared to get the prime number..the value of f decides if its a prime number.. :)
ReplyDeleteF is the integer used here. Like j and i..i and j is compared to get the prime number..the value of f decides if its a prime number.. :)
ReplyDeleteIf I declare f=0 outside the loop,will it make any difference? ?
ReplyDeleteIf I declare f=0 outside the loop,will it make any difference? ?
ReplyDeletevery help full thankyou sir
ReplyDeletewoooooow 10qqqqqqqqqqqqqqqqqqqqqq
ReplyDeletevery help full thankyou sir
wooooooooooooooooow 10 qqqqqqqqqqqqqqq
ReplyDeletevery help full thankyou sir