728x90 if4 [C Examples] 입력된 숫자의 각 자리수를 더하고 3과 9로 나누어지는지 살펴보는 예제코드: do while(), if() 입력된 숫자의 각 자리수를 더하고 3과 9로 나누어지는지 살펴보는 예제코드: do while(), if() 포스트 난이도: HOO_Junior # Example Codes #include int main() { int num, digit, sum=0; printf("Enter a positive integer: "); scanf("%d", &num); do { digit = num % 10; sum += digit; num /= 10; } while (num != 0); printf("The sum of the digits = %d\n", sum); num = sum; do { num -= 3; } while (num >= 3); if (num == 0) { printf("%d is divisible b.. 2023. 3. 23. [C Examples] 입력한 온도 값에 따라 온도 상태 구분하기 예제 코드: if(), else if(), while() 입력한 온도 값에 따라 온도 상태 구분하기 예제 코드: if(), else if(), while() 포스트 난이도: HOO_Junior # Example codes #include int main(){ int temperature[50]; int n,i,hot=0,pleasant=0,cold=0; float average=0; printf("Enter number of temperatures:"); scanf("%d",&n); printf("Enter Temperatures: "); while(i=60&&temperature[i] 2023. 3. 22. [Python Examples] if문 예제 코드(Example of if statement) if문 예제 코드(Example of if statement) 포스트 난이도: HOO_Intern [Notice] 포스트 난이도에 대한 설명 안녕하세요, HOOAI의 Henry입니다. Bro들의 질문에 대한 내용을 우선적으로 포스팅이 되다 보니 각각의 포스트에 대한 난이도가 달라서 난이도에 대한 부분을 작성하면 좋겠다는 의견을 들었습니다 whoishoo.tistory.com [해당 포스트는 기존 2020.2.3일 자 포스트를 업데이트한 포스트입니다.] # Example 1 print("Hello, I'm HOO.") num1 = 20 num2 = 25 if num1 >= num2: print("num1이 num2보다 큽니다.") 위의 if 문 예제 코드는 if문의 기본 특징을 확인할 수 있는 간단한 if.. 2022. 7. 30. [C++ / Examples] C++ Examples #01 C++ Examples #01 #include using namespace std; int main() { cout 2020. 1. 30. 이전 1 다음 728x90