Monday, 24 February 2014

If statement in C


If statement



The keyword "if" tells the compiler that what follows is decision control statement.

"If" statement is a conditional branching statement. In conditional branching statement a condition is evaluated,if it is evaluate true a group of statement is executed,or if it is evaluate false then statement are skipped.


For example, by using an if statement to check a user entered password, your program can decide whether a user is allowed access to the program.

Syntax of if statement is:-

If(condition is true)

Execute this statement;

The condition following the keyword "if" is always enclosed with in a pair of parentheses. If the condition is true then execute the statement if false then the statement is not executed, instead the program skips past it.

The block of statements to be executed must be enclosed in opening and closing braces. If only one statement needs to be executed then braces need not be used.

Example of if program

main()

{

Int num;

Printf(“enter the number\\n”);

Scanf(“%d”,num);

If (number>0)

Printf(“number is positive”);

}


Answered by Sunil 
student, OCC (Online coaching Class)
 www.onlinecoachingclass.org

10 comments:

  1. hello if you want promotional products gifts visit at corporate gifts?

    ReplyDelete
  2. hello friends if you have any solution in mechanical design visit at Mechanical Design Solution?

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Gmail instant technical support , our technician will help you 24/7. This is our toll-free number for UK peoples.
    Gmail Technical Support

    ReplyDelete
  5. Gmail instant technical support , our technician will help you 24/7. This is our toll-free number for UK peoples.
    Gmail Technical Support

    ReplyDelete
  6. Gmail instant technical support , our technician will help you 24/7. This is our toll-free number for UK peoples.
    http://gmail-support-number.uk/gmail-technical-support

    ReplyDelete
  7. Great blog article about this topic,I have been lately in your blog once or twice now.I just wanted to say hi and show my thanks for the information provided. THANKS! Instrumentation Engineering

    ReplyDelete
  8. Hi
    Thank you for sharing New Blog, your all blog is informative and I am waiting for your new blog, thank you again for sharing the blog.


    car insurance | car insurance | travel insurance in oman

    ReplyDelete