>void main()
Use this as a template:
#include <stdio.h>
int main ( void )
{
/* Your code here */
return 0;
}
>clrscr();
Unnecessary, anti-social, and you forgot to include .
>getch();
Unnecessary, non-portable (use getchar if you must), and you forgot to include .
>but i need to make it like this:
How about something like this:
for ( n = 1; n < 10; n += 2 )
printf ( "%d\t%d\n", n, n + 1 );
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>i think it needs some formula
Do you even know how to find the square and cube of a number? It's pretty basic arithmetic, and you can use what you learned from my last post to do the output.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Do you know how to multiply two numbers in C? You can multiply a value with itself, and that's all you need to know to find the square and cube of a value.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
thanks sir.. but now i need another help i want a prgram that continuosly adds the number input then displays the sum when 0 is pressed. all i have is this old code for adding the sum.
Perhaps you are beyond help. You have been shown some good professional programming practices already . None very hard to understand. But still you go and post an aberration of code, showing your level of commitment to do things right. Am I too harsh coming to that conclusion?
Why don't you go ahead and change that code and implement the suggestions given to you, and prove me wrong.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218