Page 12 - PROGRAMMING IN C_Neat
P. 12
6.strupr():
Used to convert a string to uppercase.
General Form:
string2 = strupr(string1);
Example:
string1 = “Kandan”; Output:
string2 = strupr(string1); string2 = KANDAN
7.strlwr():
Used to convert a string to lowercase.
General Form:
string2 = strlwr(string1);
Example:
string1 = “Kandan”; Output:
string2 = strlwr(string1); string2 = kandan
_______________________________________________________________________________________
4. List the differences between while and do…while loop. *
while loop do…while loop
1. Entry controlled loop. Exit controlled loop.
2. Checks the test condition first. Checks the test condition last.
3. If the test condition is false, body of the loop Body of the loop will be executed at least once.
will not be executed.
_______________________________________________________________________________________
5. Explain break and continue statements with example. *
break Statement:
Used to exit from a loop when the test condition is true.
General Form:
break;
Example:
for( i=0; i<10; i++ )
{
_ _ _
_ _ _
if(a < 0)
break;
_ _ _
_ _ _
}
next statement;
continue Statement:
Used to skip the remaining loop statements and transfer control to the beginning of the loop.
General Form:
continue;