C Programming Exercise-01
C Programming Exercise-01
Topic : C Fundemantals
Definition : The program uses one printf function to display the following picture on the screen.
Expected output:
*
*
*
* *
* *
*
Exercise-2 : Modify the dweight.c program: define INCHES_PER_POUND as a macro for 166.
/* Name: dweight.c */
/* Purpose: Computes the dimensional weight of a 12" x 10" x 8" box */
#include <stdio.h> //directive
int main(void) //main function
{ // starting point
int height, length, width, volume, weight; // variable declaration
Reference:K. N. King “C Programming: A Modern Approach”, Norton Publishing, 2nd Edition, 2008. 1 /3
Exercise-3 : What is the output of the program?
/* Name: dweight.c */
/* Purpose: Computes the dimensional weight of a 12" x 10" x 8" box */
#include <stdio.h> //directive
int main(void) //main function
{ // starting point
int height, length, width, volume, weight; // variable declaration
Reference:K. N. King “C Programming: A Modern Approach”, Norton Publishing, 2nd Edition, 2008. 2 /3
Exercise-7 : What is the output of the program?
#include <stdio.h>
int main(void)
{
printf("Brevity is the soul of wit.\n");
printf("\n");
printf(" --Shakespeare\n");
return 0;
}
Reference:K. N. King “C Programming: A Modern Approach”, Norton Publishing, 2nd Edition, 2008. 3 /3