Semester : S1 and S2
Subject : Computer Programming
Year : 2018
Term : MARCH
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:5
The getchar() function reads a character from the terminal and returns it as an integer. This
function reads only single character at a time. You can use this method ina loop in case you want
to read more than one character. The putchar() function displays the character passed to it on
the screen and returns the same character. This function too displays only a single character at a
time. In case you want to display more than one characters, use putchar() method in a loop.
gets() & puts() functions
The gets() function reads a line from stdin(standard input) into the buffer pointed to by
str pointer, until either a terminating newline or EOF (end of file) occurs. The puts() function
writes the string str and a trailing newline to stdout.
3.
Basis for comparison നം | do-while
General Form while ( condition) { 0௦1
statements; //body of loop
} statements; // body of
loop.
} while( Condition );
Controlling Condition
Iterations
In ‘while’ loop the
controlling condition
appears at the start of tle
loop.
The iterations do not occu
if, the condition at the first
iteration, appears false.
10 ‘do-while' 1000 the
controlling condition
appears at the end of the
loop.
The iteration occurs at
least once even if the
condition is false at the
first iteration.
Example pgm
while(wdlen<2){
printf("Word length..
");
scanf("%d", &wdlen);
7
do 1
printf("Word length..
");
scanf("%d", &wdlen);
} while(wdlen<2);
4.Keywords are predefined, reserved words used in programming that have special meanings to
the compiler. Keywords are part of the syntax and they cannot be used as an identifier. Keywords
in C Language auto double int struct
break else long switch case enum
register typedef char extern return
union
continue for signed void
do if static while
default goto _ sizeof volatile
const float
5.
short unsigned