programming1 - 2-convert… 3-exit” scanf i 3 Use...

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

View Full Document Right Arrow Icon
Branching If, else switch Looping While, do while, for For building a menu you need both branching and looping Loop { print { “Menu Options” } Scanf (“ “, i) Branching { { code1---EUR>$ } { code 2: $ to EUR } } Code 1 extract if(score>=90) printf(“A”); else if(score>=80) printf(“B”); else if(score>=70) printf(“C”) else if(score>=60) printf(“D”) else printf(“F”) Testing the prime number For(d=2 ; d<input ; d++) If (input%d==0) Break; 1 is not a prime number. N is the number to be checked.
Background image of page 1

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

View Full DocumentRight Arrow Icon
No prime number can be checked with sqrtn Scanf(“%d%d, &start_day,&days_month); Date=1; Week_counter=7; For(;start_day>1;start_day-) { printf(“ “) week_counter-; } while(date<=days_month) { if(week_counter==0) {week_counter { printf(“Menu options:”) “1-convert…….
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: . 2-convert…. . 3-exit” scanf(_____, i 3) Use “switch(menu_option) Case1: Option1code Break; …. Case3: Return0; Default: Printf(“illegal option”) Rounding Cents and Fahrenheit should be rounded off to the nearest integer Cent_float=0.998 Cent_int=1.00 #include<stdio.h> int main(void) int option; while(i) { printf(“\nmenu\n”); printf(“option1\n”); printf(“option2\n”); printf(“3 exit\n”); scanf(“%d”, &option); switch(option) { case 1: temp1=1 tem2=1 scanf(“%d”,&fibonum); for(i=0;i<fibonum;i++) break; do not forget to put after each statement case2: print f(code 2) break; case3; return 0; default: printf(“illegal option”) }...
View Full Document

This note was uploaded on 03/15/2010 for the course EE 16005 taught by Professor Krasner during the Spring '10 term at University of Texas.

Page1 / 3

programming1 - 2-convert… 3-exit” scanf i 3 Use...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online