{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Chapter 1-p - Program main cfw*printing begins printf(I see...

This preview shows pages 1–3. Sign up to view the full content.

Program main( ) { /*…………printing begins………………*/ printf(“I see, I remember”); /*………………printing ends…………………*/ } Fig 1.2 A program to print one line of text Addition of Two Numbers Program /* Programm ADDITION line-1 */ /* Written by EBG line-2 */ main() /* line-3 */ { /* line-4 */ int number; /* line-5 */ float amount; /* line-6 */ /* line-7 */ number = 100; /* line-8 */ /* line-9 */ amount = 30.75 + 75.35; /* line-10 */ printf(“%d\n”,number); /* line-11 */ printf(“%5.2f”,amount); /* line-12 */ } /* line-13 */ Fig.1.4 Program to add two numbers Program /*--------------------- INVESTMENT PROBLEM --------------------*/ #define PERIOD 10 #define PRINCIPAL 5000.00 /*-------------------- MAIN PROGRAM BEGINS --------------------*/ main() { /*------------------- DECLARATION STATEMENTS ----------------*/ int year; float amount, value, inrate; /*------------------- ASSIGNMENT STATEMENTS -------------------*/ amount = PRINCIPAL; inrate = 0.11; year = 0;

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

View Full Document
/*------------------ COMPUTATION STATEMENTS -------------------*/ /*--------------- COMPUTATION USING While LOOP ----------------*/ while (year <= PERIOD) { printf (“%2d %8.2f\n”,year, amount); value = amount + inrate * amount;
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

Chapter 1-p - Program main cfw*printing begins printf(I see...

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

View Full Document
Ask a homework question - tutors are online