Week07 - n> 0 b partitions the interval[a,b in n...

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

View Full Document Right Arrow Icon
ENEE 140: Introduction to Programming Concepts for Engineers [email protected] © Gang Qu Spring 2010 Week 7 Problem Solving by Programming Lab report: No lab report due this week. Work on the project. Lab 11: Monday March 22 Lab 12: Monday March 24 This week’s questions are all directly related to the project. 1. file I/O: revisit week05_1.c 2. formatted output: revisit week05_3.c, particularly the example and part c. 3. formatted output: implement the UNIX cal function in a. type the following UNIX command and see the output cal 3 2010 cal 2010 man cal Question: do you know which day of the week Jan. 1, 1 was? b. Write a program that prints out the following (which is the output when you type in cal 3 2010 in UNIX). You will need to use loop and % operator. March 2010 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 4. Write a C program that
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n > 0. b. partitions the interval [a,b] in n subintervals of equal length. The last subinterval may be smaller. (See the examples below). c. prints out the end points of each subinterval (see examples below) Example: I n p u t : 1 8 2 O u t p u t : 1 4 5 8 ENEE 140: Introduction to Programming Concepts for Engineers [email protected] © Gang Qu Spring 2010 Input: 1 10 3 O u t p u t : 1 4 5 8 9 10 I n p u t :-5 1 5 4 O u t p u t :-5 0 1 6 7 12 13 15 5. Write a C program that a. reads in a positive integer k b. prints out the 10’s digit k c. prints out the number of digits in k Example: I n p u t : 1 8 O u t p u t : 2 1 I n p u t : 1 3 8 O u t p u t : 4 0 I n p u t : 9 8 1 O u t p u t : 3 8 Lecture 6 Outline: 1. more on program selection (switch statement) 2. more on loops (while, do-while statements) 3. programming examples 4. questions about the project...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern