Please write in C: 1.) Assume that c is a char variable that has been declared a
ID: 3756370 • Letter: P
Question
Please write in C:
1.) Assume that c is a char variable that has been declared and already given a value. Write an expression whose value is 1 if and only if c is a space character.
2.) Assume that c is a char variable that has been declared and already given a value. Write an expression whose value is 1 if and only if c is a tab character.
3.) Assume that n has been declared and initialized as an int. Write an expression whose value is true if 17 is a factor of n (i.e. if n is divisible by 17).
Explanation / Answer
Answer 1)
#include <stdio.h>
int main()
{
char c = ' ';
if (c == ' ')
printf("The value is TRUE when character is space ");
else
printf("The value is FALSE when character is space ");
}
Answer 2)
#include <stdio.h>
int main()
{
char c = 'b';
if (c == ' ')
printf("The value is TRUE when character is tab ");
else
printf("The value is FALSE when character is tab ");
}
Answer 3)
#inculde <stdio.h>
int main()
{
int n = 35;
if ((n % 17) == 0)
printf("The value is TRUE when number n is divisible by 17 ");
else
printf("The value is FALSE when number n is not divisible by 17 ");
}