Oct
21
2015

Algoritma dan Pemrograman. Selection

Selection

– If : 1 Statement => True or False
– If else : 1 Statement
– Switch case : Expression

– IF ELSE

example: if (……);
                  else
                  if(……);
                  else
                  if(…..);

SWITCH-CASE

switch(op){
case(‘+’): printf(“ = %f”, val1 + val2); break;
case(‘-’) : printf(“ = %f”, val1 – val2); break;
case(‘*’) : printf(“ = %f”, val1 * val2); break;
case(‘/’) : printf(“ = %f”, val1 / val2); break;
default :   printf(“ unknown operator!”);

 

Written by radityakottama in: Uncategorized |

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress. Kredit, Streaming Audio | Theme by TheBuckmaker.