473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

can't able to get output

rampraveen
#include"main.h"
int i;
int sum=0;
void main()
{
char choice;
printf("enter E-->even O-->odd");
choice=getch();
choice=toupper(choice);
if(choice=='E')
{
void even();
getch();
}
else if (choice=='O')
{
void odd();
getch();
}
else
{
printf("choice is wrong");
}}
void even()
{
for (i=0;i<100;i+=2)
{
sum+=i;
}
printf( "\n%4d %4d",i-2,sum);
}
void odd()
{
for(i=1;i<100;i+=2)
{
sum+=i;
}
printf("\n%4d %4d",i-2,sum);
}

IF any body knows pls tell....if i run i can 't able to get any output..but it does not give any error....
May 7 '10 #1

✓ answered by jkmyoung

Get rid of the word void before the function name, when you are calling it.

6 1373
newb16
687 512MB
because you call it like
void even();
, it is not called.
May 7 '10 #2
so how can i call that function..? what changes i have to do in that program? pls tell..
May 7 '10 #3
newb16
687 512MB
The same way as you call printf.
May 7 '10 #4
jkmyoung
2,057 Expert 2GB
Get rid of the word void before the function name, when you are calling it.
May 7 '10 #5
really thanks.....i got correct output...
May 7 '10 #6
donbock
2,426 Expert 2GB
The following syntax is used for function prototypes:
Expand|Select|Wrap|Line Numbers
  1. void even();
  2. int odd();
Function prototypes are good, but they do not usually occur within a block. A function prototype declares the function (that is, it tells the compiler that this function exists). Nothing wrong with declaring the function, but what you truly want to do at those points in your program is call the function.

What has your teacher or textbook said about how to use functions?
May 7 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: sumGirl | last post by:
Hi all. I have a stored procedure on my sql server that returns a simple informtation about that tim a database was backed up. I owuld like to create an HTA that operator types can look at to make...
1
by: fang | last post by:
Really confusing, I am using visual stdio C++ 6.0 I add a new project file into my current workspace. If I use the default output directory like default and release, everything works fine. But...
3
by: ferbar | last post by:
Hello all, This may sound pretty basic stuff.. but I'm working on a socket example whose client seems to work fine, but the server doesn't send to the client the expected result. The problem is...
1
by: Basil | last post by:
We are working on a project which it requires to invoke a command on a remote server and read the output and process the response. What do we need to accomplish this task. Thanks for any...
0
by: senthilavs | last post by:
Hi, Im having word document in the Server Machine. While im trying to open the file in Client Machine file is opening in Server only. I need to open in the client only. This is an ASP.NET project...
2
NewYorker
by: NewYorker | last post by:
Hello comrades, I am a Dev-C++ beginner and need your help please. I've downloaded Dev-C++ in my computer but it seems to be one problem. After I type in my program,correctly, in the EDITOR and...
0
by: kowndinya | last post by:
I have created a small program with Data Environment. database is MS Access. It is working fine on my computer where VB 6 was Installed. I want to use this program on different machines where there...
0
by: nareshkumarhk | last post by:
I have a problem in writing a coustom Control in Atlas toolkit... I had been following Shawn Bruke's tutorails for this .... he had give the code for extender.cs as ...
6
by: kareemaffan | last post by:
Hello Everyone I want to insert values into MS Access database through VB.NET in Visual Studio 2005 . I have used the following code which is not working. Private Sub Button2_Click(ByVal sender...
3
shrek123
by: shrek123 | last post by:
How can I pass output of some perl subroutine to a subroutine? I have Subroutine1 and wanna pass the return value of this subroutine as an argument to another subroutine. I tried this; ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.