COP 4338 Lecture 2: 1ST C PROGRAM

60 views36 pages
School
Course
Professor

Document Summary

In c don"t have string type but array of char instead. Need semi colon after evey lines. printf( hello ); printf( world ); printf( \n ); > new line. Write prgrm drawing table conversion fahrenheit to degrees: /* print farheneit celcius table for main() fahr = 0, 20 */ int fahr, celsius; int lower, upper, step; %6d > print 6 char wide int so if int is 36 > 000036. %6f > print 6 char wide oat point. %. 2f > print oat point 2 char after decim point (left side of oat point not restricted) %6. 2f > print oat 6 wide before point and 2 after point. %o for octal ; %x for hexa ; %c for char ; %s for string ; %% for % itself. using for loop: #include int farh; for (farh =0; fahr <= 300 ; fahr = fahr +20) printf( 3%d %6. 1f\n , fahr, (5. 0/9. 0)*(fahr-32));

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers