1.Write a program that subtracts the value 15 from 87 and displays the result, together with an appropriate message, at the terminal.
2. Identify the syntactic errors in the following program. Then type in and run the corrected program to ensure you have correctly identified all the mistakes.
- #include <stdio.h>
int main (Void)
{
INT sum;
/* COMPUTE RESULT sum = 25 + 37 – 19
/* DISPLAY RESULTS //
printf ("The answer is %i\n" sum);
return 0;
}
3.What output might you expect from the following program?
#include <stdio.h>
int main (void)
{
int answer, result;
answer = 100;
result = answer - 10;
printf ("The result is %i\n", result + 5);
return 0;
}
4.What output would you expect from the following program?
#include <stdio.h>
int main (void)
{
char c, d;
c = 'd';
d = c;
printf ("d = %c\n", d);
return 0;
}
5.Find the cost of 5 items if the unit price is 10.50 Rupees.
0 Comments