This commit is contained in:
2023-10-03 12:50:05 +01:00
parent cd1d50183b
commit 0fe9a5ef19
5 changed files with 86 additions and 7 deletions

View File

@@ -3,20 +3,25 @@
int main(void)
{
// Declare some variables
int a = 7, b=6;
// Declare some variables
int a = 7, b=6;
printf("Enter a value for a: ");
scanf("%d", &a);
printf("Enter a value for b: ");
scanf("%d", &b);
// A single line of code conditional on the value of a
if ( a == 7 )
printf ("The value of a is 7 - so I will do this\n");
printf ("The value of a is 7 - so I will do this\n");
// Multiple lines of code conditional on b not equalling 4
// so then need to be placed inside { and }
if ( b != 4 )
{
printf ("The value of b is not 4\n");
printf ("So I will do multiple tasks\n");
printf ("The value of b is not 4\n");
printf ("So I will do multiple tasks\n");
}
return 0; // Exit from main
}
return 0; // Exit from main
}