c/declarations,loops

This commit is contained in:
Marc Beninca 2018-12-11 21:56:47 +01:00
parent 4b3b97e04b
commit 920e032038

View file

@ -13,14 +13,21 @@ Main
system("pause"); system("pause");
} }
Declarations
------------
.. code:: c
char operator;
int entry1 = 0;
int entry2 = 0;
long entry = 0;
Input Input
----- -----
.. code:: c .. code:: c
int entry1 = 0;
char operator;
int entry2 = 0;
printf("type in 2 integers\n"); printf("type in 2 integers\n");
scanf("%d%s%d", &entry1, &operator, &entry2); scanf("%d%s%d", &entry1, &operator, &entry2);
printf("sum: %d\n", entry1 + entry2); printf("sum: %d\n", entry1 + entry2);
@ -45,3 +52,12 @@ Conditions
default: default:
printf("Nope!\n"); printf("Nope!\n");
} }
Loops
-----
.. code:: c
while (condition) {
expression1;
}