There are better ways to do this, but the following example will get the job done all the same.
#include <iostream>
int foo(int & X, int & Y)
{
if( X > Y ) // Ensure X < Y.
{
int T = X; X = Y; Y = T; // Swap.
}
int Total = X;
if( X!=Y) // Skip summation when equal (1 to 1 = 1).
{
int Addend = X; // Begin summation.
while(++Addend <= Y) Total += Addend;
}
return( Total );
}
int main()
{
int X, Y;
std::cout << "Enter start value: ";
std::cin >> X;
std::cout << "Enter end value: ";
std::cin >> Y;
std::cout << std::endl;
std::cout << "The summation of " << X << " to " << Y << " is: " << foo( X,Y);
std::cout << std::endl;
return( 0 );
}
write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program
This is not a question.
There is no gotoxy statement in C.
write a vb program to find the magic square
Write a merits and demerits of using function in program
write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program
#include<
This is not a question.
give an example of calculation of mathematics
not possible dude
There will be a function in it like this: double RectangleArea (double a, double b) { return a*b; }
Use text-editor notepad++
swap (int *a, int *b) { *a ^= *b; *b ^= *a; *a ^= *b; }
I don't think its possible. Every C++ program must at least have the main function.
There is no gotoxy statement in C.
write a sample program using asp.net explaining all the syntax and semantics of the program
C:#includeint main(){int num,sum,avg=0,i;printf("enter a number");scanf("%d",&num);for(i=0;i