
#3200 
Hello my community,
I am new to this forum & want to solve a project question.Ave tried my best but it is not executing, shows 8 errors. I am trying to find the prime numbers between 1 7000.The sub intervals that holds themost prime numbers and printing a histogram.
123456789101112131415161718192021222324252627<br />#include<stdio .h><br />#include<conio .h><br />void main()<br />{<br />int num = 0;<br />prime_num(num);<br />}<br />{<br />for(int i=0;i< =7000;i++)<br />{<br />for(int j=2; j < = 7000;j++)<br />{<br />if( i != j && 1 != j)<br />{<br />return 0;<br />break;<br />}<br />if(num%1 == num)<br />{<br />if (isprime)<br />{<br />printf("Prime:", i);<br />}<br />return 1;<br />}<br /></conio></stdio> 
#3202 
Hi Mr. Vahid Majidi,
I am Lalit Sharma and I have a query.
Please help me to write a program in C++, How to count all the three digit number tht lie between 100 to 300 and whose 1st & last digit is 2.
If possible then please reply me at lalit.sharma83@rediffmail.com.
Hope to hear from you 
#3203 
How to count all the three digit number tht lie between 100 to 300 and whose 1st & last digit is 2?
Ans:123456789101112131415161718192021222324252627282930313233#include<iostream><br />using namespace std;<br />void display()<br />{<br />int count = 0;<br />for(int i = 100;i<300;i++)<br />{<br />int value = i;<br />if(((value%10)== 2) &&(value/100)==2)<br />{<br />cout< <value<<endl;<br />count++;<br />}<br />}<br />cout< <"Total Number "<<count<<endl;<br />}<br />void main()<br />{<br />display();<br />}<br />output:<br />202<br />212<br />222<br />232<br />242<br />252<br />262<br />272<br />282<br />292<br />Total Number 10<br /></iostream> 
#3204 
Thats awsome I was thinking about this one.
This is the way I was going
12345678910111213141516171819202122#include <iostream><br />#include <algorithm><br />#include <vector><br /><br />bool IsThis (int x) { return (x=1); }<br />bool IsAnswer (int i) { return (((i%10)==2)&(i/100)==2); }<br />int main () {<br />int mynumbers;<br />int mycount;<br /><br />std::vector<int> myscope;<br />for (int x =100; x<300; x++) myscope.push_back(x);<br />std::vector</int><int> myvector;<br />for (int i=100; i<300; i++) myvector.push_back(i);<br /><br />mynumbers = (int) count_if (myscope.begin(), myscope.end(), IsThis);<br />std::cout < < "myvector contains " << mynumbers << " numbers between 100 and 300.n";<br /><br />mycount = (int) count_if (myvector.begin(), myvector.end(), IsAnswer);<br />std::cout < < "myvector contains " << mycount << " numbers that begin and end with 2.n";<br />return 0;<br />}</int></vector></algorithm></iostream> 
#3205 
Hi Arun,
I thank you very much for my problem solving.
Dear Arun, I have not executed this program but I’ll try it today.
Anyway many thanks once again.
Thanks & Regards,
Lalit Sharma
“Knowledge speaks & Wisdom listens”. 
#3206 
Hi mr_rich,
I thank you very much for my problem solving.
Dear friend, I have not executed this program but I’ll try it today.
Anyway many thanks once again.
Thanks & Regards,
Lalit Sharma
“Knowledge speaks & Wisdom listens”.
You must be logged in to reply to this topic.