Explorar el Código

new file l4.c

Stepan hace 2 meses
padre
commit
e3dbc13e9a
Se han modificado 1 ficheros con 23 adiciones y 0 borrados
  1. 23 0
      c/l4.c

+ 23 - 0
c/l4.c

@@ -0,0 +1,23 @@
+#include <stdio.h>
+int main() {
+    int x = 7;
+    int s = 0;
+    while(1) {
+        int pol;
+        printf("Number ");
+        scanf("%d", &pol);
+        if(pol == 7) {
+            printf("the number is guessed\n");
+            break;
+        }
+        else {
+            printf("the number is not guessed\n");
+            s++;
+            if(s == 3) {
+                printf("Game over\n");
+                break;
+            }
+        }
+    }
+    return 0;
+}