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

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

View Full Document Right Arrow Icon
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");
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.

Page1 / 4

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

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