C third day loop in iOS

Source: Internet
Author: User

////main.m//lessoncircle////Created by Laouhn on 15/7/16.//Copyright (c) 2015 Chi Hai Tao. All rights reserved.//#import<Foundation/Foundation.h>intMainintargcConst Char*argv[]) {    /*1. The loop structure is executed repeatedly under the specific conditions of the code snippet. Initialization loop variable initialization, condition loop condition increment loop increment*/   //1?? ---2?? ----4?? ----3?? ---2?? ---4?? ----3?? ............ 2??//For (1?? int i = 0;2?? I < 100;3?? i++) {//4?? printf ("I'm handsome, you're a!%d\n", i);//    }////for (int i = 1; i <=; i++) {//if (i% 2! = 0) {//printf ("%d\n", I);//        }//    }//for (int i = 1; I <= 100; i++) {//if (i% 7 = = 0 | | I/10 ==7 | | (i% 10 = = 7)) {//continue;//        }//printf ("%d\n", I);//    }//int sum = 0;//for (int i = 1; i < 101; i++) {//sum = sum + i;//    }//printf ("%d", sum); //int jsum = 0;//int osum = 0;//int qisum = 0;//int geiweiqisum = 0;//int shiweisum = 0;//int wuqi = 0;//for (int i = 0; i < 101; i++) {//if (i% 7 = = 0)//Qisum + = i;//if (i% 2 = = 0) {//Jsum + = i;//}else//osum +=i;//if (i% ==7) {//geiweiqisum +=i;//        }//if (I/10 ==7)//        {//Shiweisum + = i;//        }//if (i% 7! = 0 && i/10!=7 && (i%! = 7)) {//Wuqi +=i;//        }//    }//    //printf ("Odd%d\n, even%d\n number 7 and%d\n, is a multiple of 7 and%d\n, 10 bits 7 and%d\n, does not contain 7 not 7 multiples and%d", Jsum,osum,qisum,geiweiqisum,    SHIWEISUM,WUQI); //Shortcut cmd + ALT + [] Move whole line//for (int i = 0; i < 3; i++) {//for (int i =1; i < 4; i++) {//printf ("%d", I);//                    }//printf ("\ n");//    }////for (int i = 0; i < 3; i++) {//For (int j = 1;j <= i+1; j + +) {//printf ("%d", j);//        }//printf ("\ n");//    }    /*1 456*///   //int j=1;//for (int i = 0;  i< 3; i++) {//For (int j = 1; J <=3-i; J + +) {//printf ("%d", j);//        }//printf ("\ n");//    }//for (int i = 1; i < 7; i++) {//if (i = = 2| | i==4) {//printf ("\ n");//        }//printf ("%d", I);//      //    }//for (int i = 0; i < 3; i++) {//For (int j = 3; j > i; j--) {//printf ("%d", j);//        }//printf ("\ n");//    }    /*1 456*///for (int i = 0; i < 3; i++) {//For (Int J =1 + i; j < i+1; J + +) {//printf ("%d", j);//        }//printf ("\ n");//    }    /*     *    * *   * * *    * *     *     */    /*for (int i = 0;i < 3; i++) {for (int j = 2;j > i; j--) {printf ("");        } for (int k = 0; k < i+1; k++) {printf ("*");    } printf ("\ n");        } for (int i = 0;i < 2; i++) {for (int j = 0;j < i+1; J + +) {printf ("");        } for (int k = 2; k > i; k--) {printf ("*");    } printf ("\ n"); }     *///for (int i = 0; i < 101; i++) {//if (0 = i% 2) {//continue;//        }//printf ("%d", I);//    }    //Enter a number from the console to determine if it is prime//int a = 0;//printf ("Please enter an integer:");//scanf ("%d", &a);//int i = 2;//For (; i < A; i++) {//        //judgment, if I have a factor in the process of increment, then A is not a prime number.//if (a% i = = 0) {//printf ("A is not a prime number");//Break ;//        }//    }//if (i = = a)//    {//printf ("A is Prime");//    }    //While Loop//while loop: a loop that is often used to not know the number of loops//The for loop can be converted to a while loop, while a while loop does not necessarily replace the for loop//int i = 1;//While (i<=100)//    {//printf ("%d", i++);//    //    }//While (i <=)//    {//if (i% 7! = 0 && I/10! = 7 && i%! = 7) {//printf ("%d", I);//        }//i++;//        //    }    //Do...while: If the condition of no disturbance is satisfied, the loop body is executed first and then the cyclic condition is determined to satisfy//Do {//printf ("%d", I);//i++;//} while (i<101);//return 0;printf"%d", Arc4random ()% One); //random number of [A, b] interval: arc4random ()% (b-a + 1) + A; //Loop Summary: 1. Cyclic variable initialization, 2. Loop condition, 3 loop variable increment, 4, loop body//Loop Execution Order: 1-2 -4-3-2-4 -3.......2 (Finally, the loop condition is not satisfied, jump out of the loop)//the difference between A for loop and a while loop://When you know the number of loops, use a For loop, and when you don't know the number of loops, use the while loop//The for loop can be converted to a while loop, while a while loop does not necessarily convert to a for loop//the difference between a while loop and a do ... while loop://The while loop first determines whether the loop condition is satisfied, then executes the loop body, and the do...while loop, regardless of whether the loop body is satisfied, executes the loop body first and then determines whether the cyclic condition satisfies}

C third day loop in iOS

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.