|
|
. |
|
C
For Swimmers : Mastering C step-by-step |
|
|
|
Programming
Problems - II
|
| NOTE:
Following set of C code snippets (non-portable) are tested with
TurboC compiler only.
|
|
Description
|
Size
|
|
Write a program (W.A.P.) in C to clear the screen and print
C FOR SWIMMERS on each
line, forming a
diagonal pattern running from upper-left to lower right.[Use
suitable delay]
|
1Kb
|
Some C
Functions take variable argument list in addition to
taking a number of fixed (known) parameters. Implement
using USER-DEFINED C FUNCTION that take VARIABLE ARGUMENT
LIST and COMPUTE THE SUM OF VALUES specified in the list.
Ex: int Sum(int a,...) // Here ... means VARIABLE
ARGUMENT LIST
{
// Your Code Goes Here to access the values in the
variable argument list
}
void main(void)
{
printf("%d",Sum(5,6,7,8,9,10)); // Prints the
RESULT (Sum of these values=45)
}
|
1Kb
|
|
W.A.P. in C to compute the sum of
two values using function that takes two
arguments (INTEGERS) and IT SHOULD RETURN
the sum WITHOUT USING the RETURN statement but
the return type of function is INTEGER ('int' data type).
[NOTE : DO NOT MAKE USE OF ANY GLOBAL VARIABLES OR POINTER
CONCEPT]
|
1Kb
|
|
W.A.P. in C to SWAP the contents
of TWO VARIABLES WITHOUT using ASSIGNMENT OPERATOR.
[HINT : USE 'asm' statement]
|
1Kb
|
|
W.A.P. in C to FIND THE LARGEST
of two numbers (integer) WITHOUT using ?: operator, if,
if...else and switch statements. [HINT : USE 'asm'
statement]
|
1Kb
|
W.A.P.
in C to print
the following output WITHOUT USING GOTO
STATEMENT, CONDITIONAL
STATEMENTS (if, if...else & switch statements) and
ANY LOOP STATEMENTS
(for, while & do..while) :
*****
****
***
**
*
|
1Kb
|
W.A.P.
in C to print
the following output WITHOUT USING GOTO
STATEMENT, CONDITIONAL
STATEMENTS (if, if...else & switch statements) and
ANY LOOP STATEMENTS
(for, while & do..while) :
*
**
***
****
*****
|
1Kb
|
|
W.A.P. in C to REVERSE THE WORDS
IN A GIVEN LINE OF TEXT. [HINT : USE Built-in
function 'strtok' in 'string.h' header file]
|
1Kb
|
|
W.A.P. in C to READ a line of
text and WRITE it out BACKWARDS using RECURSIVE Function.
|
1Kb
|
| Watch
out for more...
|
|
Code contributors will be
highly appreciated and acknowledged. Send your feedback about
Programming Problems section to nandakishorkn@rediffmail.com
|
|
|
|
|
You are
Visitor No. 
Sign
my Guestbook
View
my Guestbook
Thanks for using C For Swimmers.
Regarding this material, you can send Bug Reports,
Suggestions, Comments, etc. to
nandakishorkn@rediffmail.com
|
|
|
Note: All
logos or trademarks are related to their respective owners.
Although every
precaution has been taken, the designer(s) owe no responsibility
for malicious errors.
No liability assumed
for damages resulting from the use of the available information.
|