# Lab8 - ECS 102 Lab 8 Spring 2011 Name Sec 1(3:45 2(12:45...

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

ECS 102 Lab 8 Spring 2011 Name ______________________________ Sec 1(3:45) 2 (12:45) Anywhere that I ask you to observe what happens, write down your observations in the space provided. I. Here is a program that will introduce you to the if and the if . .. else statements. Run it with a variety of data so you understand how it works. /* learningIf.c */ #include<stdio.h> /* function prototyptes */ void checkLegal(int age); char sign(double num); int main(void) { /*declarations go inside main, at the beginning*/ int age; double x; char theSign; char grade; int guess; /*Determine if of legal drinking age.*/ printf("How old are you? "); scanf("%d", &age); checkLegal(age); /*Determine the sign of a number.*/ printf("Enter a real number for sign checking: "); scanf("%lf", &x); theSign = sign(x); printf("The sign of %.2f is %c\n", x, theSign); /*Play fickle pickle.*/ printf("Enter a five digit number: "); scanf("%d", &guess); if (guess == 58329) printf("Congratulations! You win a jar of pickles!\n");

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 05/05/2011 for the course EEE 212 taught by Professor Des during the Spring '11 term at Syracuse.

### Page1 / 4

Lab8 - ECS 102 Lab 8 Spring 2011 Name Sec 1(3:45 2(12:45...

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

View Full Document
Ask a homework question - tutors are online