Turn off the light problem

Source: Internet
Author: User

#include <stdio.h>#include<string.h>#defineMAX 1000+10int_light[max];intMain () {intLight =0, _alllight =0, i =0, j =0, _preson =0, Firstpreson =1; memset (_light,0,sizeof(_light)); printf ("Please enter the all light and Preson:"); scanf ("%d%d", &_alllight, &_preson);  for(i =1; I <= _preson; i++)         for(j =1; J <= _alllight; J + +)        if(j%i = =0) _light[j] =!_light[j];//the use of switching lights is 0 and 1 of the characteristics of the array subscript is the position of the lamp     for(i =0; I <= _alllight; i++)    {        if(_light[i]) {if(Firstpreson) Firstpreson=0; Elseprintf (" "); printf ("%d", i); }} printf ("\ n"); return 0;}

Turn off the light problem

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.