turbo C prog. Q3

Ads

 
 

Share on Google+Share on Google+

Arijit Maji
turbo C prog. Q3
1 Answer(s)      6 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.

Ads
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);
   }

Ads









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
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
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
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
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
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++  How can i write this in dev c
C++
C++  How can i write this in dev c
c#
c#  how to find out the size of the BMP image in C
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
please help me in these prog
please help me in these prog   create 2 jdbc programs including awt create 2 jdbc programs including swing create 2 jdbc programs including command line argument create 2 jdbc programs including io class 4 jdbc prog using
c++
c++  use a prgrm as an example to xplain-: a)class b)object c)message d)cope resolution operator
c++
c++  write a programme that calculates the area and circumference of a rectangle
c#
c#  how to find out the size of the BMP image
C++
C++  dear sir How to create windows form application for login screen using C++? USER Name -TESTADMIN Password -testuser
c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples

Ads

 
Advertisement null

Ads