In: Computer Science
#include <stdio.h>
int main (void) {
printf(“Parkinson’s Law: \n Work expands so as to \t”);
printf(“fill the time \n”);
printf(“\t available for its completion.”);
return 0;
}
Solution 1)
//Directive -stdio.h
#include <stdio.h>
int main(void)
{
//Statement-printf
printf("\nParkinson's Law:\nWork expands as to ");
//Statement-printf
printf("fill the time\n");
//Statement-printf
printf("available for its completion.\n\n");
return 0;
}
Output of the program:
Solution 2)
(a) a * b - c * d + e
((a*b)-((c*d))+e)
(b) a / b % c / d
(a/b)%(c/d)
(c) - a - b + c - + d
Incorrect expression -error
(d) a * - b / c - d
((a* -(b/c))-d)
Solution 3)
if i and j are positive integers, does (-i)/j always have the same value as –(i/j)?
Yes they both will always have the answer .
Why?
Because c compiler acts just like a normal scientific calculator
for this case due to the Operator precedence.
Example:
#include <stdio.h>
int main(void)
{
int i,j,x,y;
i =33;
j=3;
x=((-i)/j);
y= (-(i/j));
printf("%d",x);
printf("\n");
printf("%d",y);
return 0;
}
Output:
Please don't hesitate to contact me if you have any queries. :)