This content originally appeared on DEV Community and was authored by legend
hello everyone i've been writing this program for counting numbers and i want to print it from certain starting point to certain extent
//counting machine
#include<stdio.h>
int main()
{
int q1,q2,q3,q4,q5,q6,c=0,NOL,st;
printf("enter the number from where to how much combinations you want: ");
scanf("%d %d",&st,&NOL);
q1=q2=q3=q4=q5=q6=0;
for(q1=0;q1<=60;q1++)
{
for(q2=0;q2<=60;q2++)
{
for(q3=0;q3<=60;q3++)
{
for(q4=0;q4<=60;q4+=2)
{
for(q5=0;q5<=60;q5+=5)
{
for(q6=0;q6<=60;q6+=5)
{
c++;
if((q1+q2+q3+q4+q5+q6)==60 && c>=st && (q4/2)<=5)
{
if(c<=NOL)
{
printf("%d %d %d %d %d %d \n",q1,q2,q3,q4,q5,q6);
}
}
}
}
}
}
}
}
}
This content originally appeared on DEV Community and was authored by legend
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
legend | Sciencx (2024-06-30T09:57:46+00:00) c program for counting numbers. Retrieved from https://www.scien.cx/2024/06/30/c-program-for-counting-numbers/
" » c program for counting numbers." legend | Sciencx - Sunday June 30, 2024, https://www.scien.cx/2024/06/30/c-program-for-counting-numbers/
HARVARDlegend | Sciencx Sunday June 30, 2024 » c program for counting numbers., viewed ,<https://www.scien.cx/2024/06/30/c-program-for-counting-numbers/>
VANCOUVERlegend | Sciencx - » c program for counting numbers. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/30/c-program-for-counting-numbers/
CHICAGO" » c program for counting numbers." legend | Sciencx - Accessed . https://www.scien.cx/2024/06/30/c-program-for-counting-numbers/
IEEE" » c program for counting numbers." legend | Sciencx [Online]. Available: https://www.scien.cx/2024/06/30/c-program-for-counting-numbers/. [Accessed: ]
rf:citation » c program for counting numbers | legend | Sciencx | https://www.scien.cx/2024/06/30/c-program-for-counting-numbers/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.