Week08 - ENEE 140: Introduction to Programming Concepts for...

Info iconThis 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 gangqu@umd.edu © Gang Qu Spring 2010 Week 8 Lab report: Write program to answer the questions 3,6, and name them week08_3.c, week08_6.c Submit by the following command: submit 2010 spring enee 140 010? 1 week08_3.c submit 2010 spring enee 140 010? 1 week08_6.c Due: check the two questions. Lab 13: Monday March 28 1. if-else: What will the output of the following code segment? Think about the answer and then check your answer by testing it in a complete program. int a =5; if (a = 0) { printf(“a=0 is true. \n”); } else { printf(“a=0 is not true.\n”); } if (a==0) { printf(“a==0 is true. \n”); } else { printf(“a==0 is not true.\n”); } 2. dangling else problem: What will be the output of the following code segment with different values to x and y? Check your answer by testing it in a complete program. int x,y; scanf(“%d%d”, &x, &y); if (x > 0) if (y>0) printf(“Both positive.\n”); else printf(“x negative, ignore y.\n”); a x = 2, y = 1
Background image of page 1

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

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

This note was uploaded on 10/11/2010 for the course ENEE 140 taught by Professor Staff during the Fall '08 term at Maryland.

Page1 / 3

Week08 - ENEE 140: Introduction to Programming Concepts for...

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