본문 바로가기

코딩32

[코딩일기] C# (연습문제) for, while using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; public class HelloWorld : MonoBehaviour {     void Start()     {         // ●●● 문제 1         // ●●● 1보다 큰 수를         // ●●● 변수 a와 b에 각각 넣고         // ●●● a에 b를 몇 번 곱하면         // ●●● 1000을 넘는지 알아내는 프로그램         // int a = 3;         // int b = 2;         // int counter = 0;         // whil.. 2024. 7. 3.
[코딩일기] C# break using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; // 종이를 몇 번 접으면 두께가 1m가 넘을까? public class HelloWorld : MonoBehaviour {     void Start()     {         float thickness = 0.0001f;    // 종이 한 장의 두께(m 단위)         int count = 0;     // 종이를 접는 횟수         while (thickness         {             count++;                 // 계속 더한다             thick.. 2024. 7. 2.
[코딩일기] C# do while using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; public class HelloWorld : MonoBehaviour {     // while과 do while의 차이점은 하나     // do while은 '일단 진행시켜.' ==> 한 번은 무조건 실행     // 그 다음에 조건을 비교함     // 즉 while은, 처음에 들어갈 때부터 조건에 안 맞으면 한번도 실행하지 않지만,     // do while은 조건에 맞든 안 맞든 일단 한 번은 실행을 하고 그 다음에 조건을 비교.     void Start()     {         int a = 1.. 2024. 7. 2.
[코딩일기] C# while using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine;// 종이를 몇 번 접으면 두께가 1m가 넘을까?public class HelloWorld : MonoBehaviour {     void Start()     {         float thickness = 0.0001f;    // 종이 한 장의 두께(m 단위)        int count = 0;     // 종이를 접는 횟수        while (thickness         {             count++;                 // 계속 더한다            thickness .. 2024. 7. 2.