Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners turbo C prog. Q3
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Arijit Maji
turbo C prog. Q3
1 Answer(s)      3 years and a month ago
Posted in : Java Beginners


What is the difference between if and ladder if ? Describe ladder if with example. What is the purpose of the parameter passing ? please Describe with example.


Advertisement
View Answers

October 3, 2011 at 3:00 PM


if statement is used to write conditional expressions. If the given condition is true then it will execute the statements. Otherwise it will execute optional statements.

syntax:

if<conditon>
{
  -----
  -----
}

While in ladder-if, conditions are evaluated from Top to Bottom. As soon as TRUE expression is found the statement associated with it is executed and rest of the ladder is Bypassed.

syntax:

if(condition-1){
   statement-1
}
else if(condition-2){
    statement-1
}
else{
    statement-2
}

Example of ladder if:

#include <stdio.h>
main()
{
    int a,b,c;
    printf("enter values for a,b,c");
    scanf("%d%d%d",&a,&b,&c);
    if(a>b && a>c)
      printf("%d is big",a);
    else if(b>c)
      printf("%d is big",b);
    else
      printf("%d is big",c);    
}

Parameter Passing is used to provide extra flexibility to a program.

#include<stdio.h>

void f(int n) {
    printf("d",n);
   }

void main() {
    int x = 2;
    f(x);
   }


Related Tutorials/Questions & Answers:
turbo C prog. Q3
turbo C prog. Q3  What is the difference between if and ladder... } Example of ladder if: #include <stdio.h> main() { int a,b,c; printf("enter values for a,b,c"); scanf("%d%d%d",&a,&b,&c); if(a>
turbo C prog.
turbo C prog.  Is is possible print ASCII value of a alphabets using turbo C prog
Advertisements
turbo C prog.
turbo C prog.  Is it possible to print ASCII value A to Z with out...;#include<stdio.h> #include<conio.h> void main() { for(char c='A';c<='Z';c++){ printf("\nASCII of %c is %i\n", a, a); } getch(); } C
(ForPro) turbo C prog. Q4
(ForPro) turbo C prog. Q4  I need to learn some easy foxpro program.. for example sum,interchange, loop etc
turbo C Question 6.
turbo C Question 6.  Explain call by value and call by reference with easy examples
turbo C Question 4.
turbo C Question 4.  Possible to print the following (Using for Loops): 1. * ** 2.* * ** * * * *   specify the format properly
turbo C Question 4.
turbo C Question 4.  Possible to print the following (Using for Loops): 1. * ** 2.* * ** * * * *   specify the format properly
turbo C Question 5.
turbo C Question 5.  is it possible to print "", 1st line (5 times),2nd line *(4 times),3rd line *(3 times),4th line *(2 times) & 5th line *(1 times) with Align Right. and also reverse order as 1,2,3,4,5 (but right aline
Conditional Statement in Turbo C
Conditional Statement in Turbo C   Write a program that computes and assesses the tuition fee of the students in one trimester, based on the given mode of payment below: Plan (Key) Discount (-) or Interest (+) Cash (1) 10
Conditional Statement in Turbo C
Conditional Statement in Turbo C   Write a program that computes and assesses the tuition fee of the students in one trimester, based on the given mode of payment below: Plan (Key) Discount (-) or Interest (+) Cash (1) 10
turbo c pre-increment question
turbo c pre-increment question  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times
Solution to C prog
Solution to C prog   Hi, Pls any body help, why the following prog crashing while running. #include<stdio.h> #include<conio.h> int main(){ int n,*fact(int *n); printf("Enter the number:"); scanf
how to get following answer in turbo c program
how to get following answer in turbo c program  input 123456789 output 1 2 3 4 5 6 7 8 9
Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times)
Can u print in turbo C  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times
Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times)
Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times)  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
NEED A PROG
NEED A PROG   whats the program to add,delete, display elements of an object using collecions. without using linked list   Hi Friend, Try the following code: import java.util.*; class CollectionExample { public
java prog que
java prog que  create a class that returns the reverse of each word in the given string. For example if we give "who are u?" as input, it should return "ohw era u
C/C++ - Development process
C/C++  I need the code for playing the backgammon game using C/C++.Im using turbo C. I`ve already design the board.I badly need the code for playing this game
question "writing prog"
question "writing prog"  Hello I want helping for this question, please Write a program that reads some friendsā?? names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
servlet prog - Java Interview Questions
servlet prog  how to forward or redirect the client request from servlet to jsp? how a thread or request pass from one servlet prog to one jsp prog? is it possible of communicating from servlet to jsp prog? please explain briefly
make a prog for this query
make a prog for this query  write a program implementing interface for personal data n salary details. interface must contain abstract methods. steps for the program are 1) store the data in text file 2)display salary when emp id
Java entry prog.
Java entry prog.  Dear sir I will enter the dept code, dept name and insert into dept_mast and save. Pl. Dept_mast Dept_code Char(2) Primary key (no duplicate key allowed) Dept_name Char(25
Prog Error - JSP-Servlet
Prog Error   Place Ad function Browse() { Advertisement Management System Create Ad State: City: Main Category: Sub Category: Title
c#
c#  how to find out the size of the BMP image in C
C++
C++  How can i write this in dev c
C++
C++  How can i write this in dev c
c++
c++  use a prgrm as an example to xplain-: a)class b)object c)message d)cope resolution operator
c#
c#  how to find out the size of the BMP image
Advertisements
 

 

 

DMCA.com