Basic algorithm of C language 27-conditional remainder

Source: Internet
Author: User

Conditional enumeration
/*
==================================================
Title: series that can be divisible by 2,3,5 at the same time
==================================================
*/
#include <stdio.h>
#define P 10000000
void Main ()
{
int n,s=0,n;
printf ("How many items do you want the output to be divisible by 2,3,5 at the same time?") \nn= ");
scanf ("%d", &n);
for (n=1;n<=p;n++)
{
if (n%2==0&&n%3==0&&n%5==0)
{
s++;
if (s<n)
{
printf ("%5d", N);
if (s%10==0)
printf ("\ n");
}
}
}
printf ("\ n");
}
/*
==================================================
Comment: Multi-Conditional enumeration method, often practice it, the basis of the foundation.
==================================================
*/

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Basic algorithm of C language 27-conditional remainder

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.