using codeblocks
-------------------------------------------------------
// program to get greatest number between two numbers
#include<stdio.h> //header file
void greater(); // function prototype/declaration with return type zero.
int main() //main function
{
greater(); // function calling.
return 0; //returns 0 value
}
void greater() // function body line ; also called function definition
{
float number1,number2; // variable declaration
printf("enter two numbers\n"); // displays message to input data
scanf("%f%f",&number1,&number2); // gets data from user.
if(number1>number2) //condition testing
{
printf("%f is greater\n",number1); // displays output
}
else
{
printf("%f is greater\n",number2); // displays output if the condition did not satisfy
}
}
/* here we have used top down approach. i.e calling from top and writing its body line down.
we can also reverse the process.*/
-------------------------------------------------------------------------
using turbo C++
---------------
//program to get greatest number between two numbers
#include<stdio.h> //header file
#include<conio.h>
void greater(); // function prototype/declaration with return type zero.
void main() //main function
{
greater(); // function calling.
getch(); //holds the output on screen
}
void greater() // function body line ; also called function definition
{
float number1,number2; // variable declaration
printf("enter two numbers\n"); // displays message to input data
scanf("%f%f",&number1,&number2); // gets data from user.
if(number1>number2) //condition testing
{
printf("%f is greater\n",number1); // displays output
}
else
{
printf("%f is greater\n",number2); // displays output if the condition did not satisfy
}
}
-------------------------------------------------------
// program to get greatest number between two numbers
#include<stdio.h> //header file
void greater(); // function prototype/declaration with return type zero.
int main() //main function
{
greater(); // function calling.
return 0; //returns 0 value
}
void greater() // function body line ; also called function definition
{
float number1,number2; // variable declaration
printf("enter two numbers\n"); // displays message to input data
scanf("%f%f",&number1,&number2); // gets data from user.
if(number1>number2) //condition testing
{
printf("%f is greater\n",number1); // displays output
}
else
{
printf("%f is greater\n",number2); // displays output if the condition did not satisfy
}
}
/* here we have used top down approach. i.e calling from top and writing its body line down.
we can also reverse the process.*/
-------------------------------------------------------------------------
using turbo C++
---------------
//program to get greatest number between two numbers
#include<stdio.h> //header file
#include<conio.h>
void greater(); // function prototype/declaration with return type zero.
void main() //main function
{
greater(); // function calling.
getch(); //holds the output on screen
}
void greater() // function body line ; also called function definition
{
float number1,number2; // variable declaration
printf("enter two numbers\n"); // displays message to input data
scanf("%f%f",&number1,&number2); // gets data from user.
if(number1>number2) //condition testing
{
printf("%f is greater\n",number1); // displays output
}
else
{
printf("%f is greater\n",number2); // displays output if the condition did not satisfy
}
}