HW #2v2.0 - int yesno; printf("State heart...

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

View Full Document Right Arrow Icon
Jince Jacob C Programming Section 1 HW #2 9-10-2007 /* HW2#1.c   Purpose: To compute income tax. */ #include <stdio.h> int main(void) { int income; int tax; printf("State income: "); scanf("%d",&income); if (income >= 1000)  tax = income * .08; else    tax = income * .05; printf("The amount you owe to taxes is $ %d\n", tax); return 0; } /* HW2#2.c   Purpose: To ask for user's heart rate and suggest exercise if needed. */ #include <stdio.h>
Background image of page 1

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

View Full DocumentRight Arrow Icon
int main(void) { int rate; int temp;
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int yesno; printf(&quot;State heart rate: &quot;); scanf(&quot;%d&quot;,&amp;rate); if (rate &gt; 56) { printf(&quot;It is advisable that you exercise.&quot;); printf(&quot;What is the temperature outside?\n&quot;); scanf(&quot;%i&quot;,&amp;temp); if (temp &gt; 85) { printf(&quot;Is it Raining (no = 0, yes = 1)?\n&quot;); scanf(&quot;%d&quot;,&amp;yesno); if (yesno == 0) printf(&quot;Why not go out for a swim?&quot;); else printf(&quot;You should stay inside.&quot;); } else printf(&quot;You should stay inside.&quot;); } return 0; }...
View Full Document

Page1 / 2

HW #2v2.0 - int yesno; printf(&amp;amp;quot;State heart...

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