using codeblocks
----------------------------------------------------------------------------------------------------
//to know a number is even or odd using function.
#include<stdio.h> //header file
void evenodd(); // function prototype/declaration with return type zero.
int main() //main function
{
evenodd(); // function calling.
return 0; //returns 0 value
}
void evenodd() // function body line ; also called function definition
{
int number; // variable declaration
printf("enter number\n"); // displays message to input data
scanf("%d",&number); // gets data from user.
if(number%2==0) //condition testing
{
printf("%f is even\n",number); // displays output
}
else
{
printf("%d is odd\n",number); //displays output
}
}
---------------------------------------------------------------------------------------
using turbo c++
----------------------------------------------------------------------------
//to know a number is even or odd using function.
#include<stdio.h> //header file
#include<conio.h>
void evenodd(); // function prototype/declaration with return type zero.
void main() //main function
{
evenodd(); // function calling.
getch(); //returns 0 value
}
void evenodd() // function body line ; also called function definition
{
int number; // variable declaration
printf("enter number\n"); // displays message to input data
scanf("%d",&number); // gets data from user.
if(number%2==0) //condition testing
{
printf("%f is even\n",number); // displays output
}
else
{
printf("%d is odd\n",number); //displays output
}
}
----------------------------------------------------------------------------------------------------
//to know a number is even or odd using function.
#include<stdio.h> //header file
void evenodd(); // function prototype/declaration with return type zero.
int main() //main function
{
evenodd(); // function calling.
return 0; //returns 0 value
}
void evenodd() // function body line ; also called function definition
{
int number; // variable declaration
printf("enter number\n"); // displays message to input data
scanf("%d",&number); // gets data from user.
if(number%2==0) //condition testing
{
printf("%f is even\n",number); // displays output
}
else
{
printf("%d is odd\n",number); //displays output
}
}
---------------------------------------------------------------------------------------
using turbo c++
----------------------------------------------------------------------------
//to know a number is even or odd using function.
#include<stdio.h> //header file
#include<conio.h>
void evenodd(); // function prototype/declaration with return type zero.
void main() //main function
{
evenodd(); // function calling.
getch(); //returns 0 value
}
void evenodd() // function body line ; also called function definition
{
int number; // variable declaration
printf("enter number\n"); // displays message to input data
scanf("%d",&number); // gets data from user.
if(number%2==0) //condition testing
{
printf("%f is even\n",number); // displays output
}
else
{
printf("%d is odd\n",number); //displays output
}
}
No comments:
Post a Comment