Home | Add to Favorites | Ebooks Directory | News  
C ,C++  Programming
Home
C , C ++  Article
C and C++  Tutorial 
C++  compiler
C++  Books
C and C++ Questions
C ++ Coding
C++ Source Code
C riddles and  Questions on Scanf Function

Scanf Function  and Questions
              
The syntax of scanf function is

int scanf(const char*string ,...)

This function returns the number of data items successfully assigned value.

 

 

Learn about ceil(),floor(),random(),randomize() functions.

ceil(1.2)=2    but floor(1.2)=1.

ceil(-1.2=-1    but floor(-1.2)=-2;


round(3.5)=4.  round(3.2)=3.

II.Conditional statements:

In c any non zero value is equal to true and so the following printf function will be executed.

1.if(-1)
{
printf("britney");
}
 


2.int i=1;
switch(i)
{
default://default can come in any order
break must be present otherwise all the statements below it will
be excuted regardless of condtion.
case 4.5://not allowed only integer
values.error
case i+1://not allowed only constant
expression(like (8*4)).error.
}

3.int i=1;
switch(i)
{
printf("night");
case 1:
printf("star"); //watch no break.
case 4:
printf("moon");
}

work it out.

4.for(printf("111");printf("222");printf("333"));           //work it out

for(printf("111");0;printf("222"));

"111222" will be the output.The loop will not get executed.

5.Difference between include "stdio.h" and include<stdion.h>

using <> will  cause the files to be searched in the current path, whereas  ""   causes the file to be searched in the current directory addition to it.

Go To Index