| | |
Prime numbers from 1 to 100
![]() |
•
•
Join Date: Nov 2009
Posts: 4
Reputation:
Solved Threads: 0
-2
#3 19 Days Ago
c Syntax (Toggle Plain Text)
#include <math.h> #include <stdio.h> int main(void){ int i, j, isPrime; for(i = 2 ; i <= 100 ; i++){ isPrime = 1; for(j = 2 ; j <= i ; j++) { if( i == j) continue; else if( i % j == 0) isPrime = 0; } if(isPrime) printf("%d, ", i); } printf("\n"); return 0; }
hope this helps...
Last edited by mruthyunjaya; 19 Days Ago at 7:58 am. Reason: wrong variable name
![]() |
Similar Threads
- prime numbers output. while loop inside a do-while loop having trouble (C++)
- prime numbers (Java)
- Standard Output Error: Forking to Obtain Prime Numbers (C++)
- finding prime numbers problem (C++)
- Program to output all prime numbers between 3 and 100 (C++)
- Average of prime number between 1 & 100 (C#)
- help with array that determines prime numbers (C)
Other Threads in the C Forum
- Previous Thread: non preemptive scheduler
- Next Thread: No such file or directory
| Thread Tools | Search this Thread |
adobe api array arrays binarysearch calculate char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o ide inches incrementoperators intmain() iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opensource openwebfoundation owf pattern pdf performance pointer posix power probleminc program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape socketprograming socketprogramming stack standard strchr string suggestions systemcall test unix urboc user variable voidmain() wab win32api windows.h





