OK....thanks everybody, this program works now...
Type: Posts; User: benw25
OK....thanks everybody, this program works now...
When I use lf for the printf statement for long doubles, it returns a bunch of jibberish...
Swoopy, I used the program above and there are several errors...
line 12 statement missing ; in function main()
line 16 compound statement missing } in function main()
line 16 function should...
If you use the long int, it gives a range of about 4 million, but that is not enough if the numbers from 1 to a million are added, and the sum is 50000005000000 or something like that...I looked up...
This program also runs really really slow...and its not just the computer...it displays about 100 numbers every 3 seconds or so...
Ok...here is my problem as follows...
#include <stdio.h>
long int main()
{
long int a, b;
a = 0;
b = 0;
while (a<1000001)
{a++;
Ok...the 2 posts above seem to work...I tried to debug some of these myself, but since I have been doing programming for about a week now, my attempts failed...thanks everybody for helping me out!
Ok...the 2 posts above seem to work...I tried to debug some of these myself, but since I have been doing programming for about a week now, my attempts failed...thanks everybody for helping me out!
Here is my program as of now...
#include <stdio.h>
long int main()
{
long int a, b;
a = 0;
b = 0;
while (a<1000001);
Here is my program as of now...
#include <stdio.h>
long int main()
{
long int a, b;
a = 0;
b = 0;
while (a<1000001);
How do you declare numbers as double integers and how do you use long integers?
How do you declare numbers as double integers and how do you use long integers?
Hey everybody...this is a new programmer....I started programming less than a week ago...I need help creating a c program that adds numbers from 1 to a million. I have tried it using many tutorials,...
Hey everybody...this is a new programmer....I started programming less than a week ago...I need help creating a c program that adds numbers from 1 to a million. I have tried it using many tutorials,...