How to print composite numbers that are consecutive | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

How to print composite numbers that are consecutive

For example, 24 ,25 ,26 ,27 and 28 are all composite numbers and also consecutive

5th Jan 2017, 1:58 PM
Bhaskar
Bhaskar - avatar
1 Réponse
+ 1
The answer: for(i=1;i<=n;i++){ for(j=i;j<=i+5;j++){ c=ob.compcheck(j); \\Use function compcheck() to check for composite no. if (c==1) \\ 1 means composite no. k++; } if (k>=2) on.disp(i ,k); \\ Use function disp() to display that follow the no. } That's all!!!
6th Feb 2017, 1:54 PM
Bhaskar M R
Bhaskar M R - avatar