Question:
Write the general Syntax for, (i) if statement(ii) if – else statement(iii) While loop?
hafsa a
2007-03-29 22:51:43 UTC
Write the general Syntax for, (i) if statement(ii) if – else statement(iii) While loop
Three answers:
Smutty
2007-03-29 23:49:02 UTC
I'll give you the syntax in C#. I think its the same in C



(i) if(condition) {

//do stuff

}





(ii) if (condition) {

// do stuff

}

else {

//do other stuff

}



(iii) while(condition) {

//here goes my stuff



//beware of infinite looping if your condition is always true

}



hope this helps
ResourceGuy
2007-03-30 15:21:54 UTC
Since you are learning to program. Check out:

berkely webcasts. Also, you can review past semesters/years via the drop down box on the upper right.

CS 162 Operating Systems and System Programming M-W 04:00-5:30 PM •

CS 61A The Structure and Interpretation of Computer Programs M-W-F 03:00-4:00 PM • •

CS 61BL Data Structures and Programming Methodology W 05:00-6:00 PM • •

CS 61C Machine Structures
Dave
2007-03-29 22:57:17 UTC
Syntax is language specific. The answer to your question depends on what programming or scripting language you are talking about.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...