2_Questions_2-1

2_Questions_2-1 - Introduction to the C Language int b =...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 15AG Questions Chapter 2: Introduction to the C Language 1. What is the type of each of the following literal constants? 5 '5' "5" 5L "5.0" 5.0 5.0f 5.25 2. Code the variable declaration and constant definitions (fill in the blanks): a). a float variable named height b). a char variable named vehicle_type initialized to the character constant C c). a defined constant, UPPER_LIMIT , for 15000 d). a memory constant, tax , initialize to 0.0825 #include <stdio.h> int main(void) { // Local Definitions // Statements return 0; } 3. Code a statement that will print the following line. Assume the total value is contained in a variable named cost . 4. What is the output displayed by the following program fragment? // Local Definitions int a = 66; 1 T h e s a l e s t o t a l i s : 4 5 . 9 9
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CIS 15AG Questions Chapter 2:
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Introduction to the C Language int b = 125; float c = 899.77; // Statements printf(" Output\n\n========\n"); printf("%c\n%04d\n%4d\n%7.2f\n", a, a, b, c); printf("========\n"); printf( "%7.3f ", c ); printf( "%7.1f ", c ); printf( "%.0f\n", c ); 5. Code a statement that will read the following data stream entered by the user from the keyboard: 45 A 23.18 into the variables as defined below: float amount; int num; char letter; 6. Write statements to prompt the user to enter two integers representing the hour and minute a vehicle entered a parking lot. Then it prompts the user to enter a character for the vehicle type (C for car, B for bus, and T for truck). char vehicle_type; int hour_in; int min_in; 2...
View Full Document

This note was uploaded on 09/02/2011 for the course CIS 15BG taught by Professor Staff during the Spring '10 term at DeAnza College.

Page1 / 2

2_Questions_2-1 - Introduction to the C Language int b =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online