DEV Community

legend
legend

Posted on

c program for counting numbers

#c

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);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more