LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-26-2009, 10:51 AM   #1
wisdompower
LQ Newbie
 
Registered: Jan 2009
Posts: 1

Rep: Reputation: 0
c programming


how to sum random numbers from c programming?
can someone help me..
 
Old 01-26-2009, 11:13 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2 on Lenovo Thinkpad W520
Posts: 7,094

Rep: Reputation: 2239Reputation: 2239Reputation: 2239Reputation: 2239Reputation: 2239Reputation: 2239Reputation: 2239Reputation: 2239Reputation: 2239Reputation: 2239Reputation: 2239
Yes, we can!

But should we
 
Old 01-26-2009, 11:24 AM   #3
Nermal
Member
 
Registered: Jan 2009
Distribution: Debian
Posts: 59
Blog Entries: 2

Rep: Reputation: 6
Your question is a little unclear, but if you are asking how to do this in C then here is a sample program:
Code:
#include <stdio.h>
int main (int argc, char *argv[])
{
  int rnum;
  int total=0;

  while( total >= 0)
  {
    rnum=(rand(100)%10);
    total+=rnum;
    printf("Total = %d after adding rnum of %d\n",total,rnum);
  }
  return 0;
}
And I have....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between Top Down programming & Bottom up programming minil Programming 1 06-17-2005 03:42 AM


All times are GMT -5. The time now is 05:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration