write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / shabeer v c
def shaf(n):
l=range(3,n+1,2)
mi=n
i=0
r=0
print l
while l[i]<n-1:
for j in range(2,l[i]):
if l[i]%j==0:
r=5
if r==0:
print l[i]
r=0
i=i+1
if __name__ == "__main__":
print "prime numbers from 2 to <101 "
shaf(100)
| Is This Answer Correct ? | 21 Yes | 46 No |
Post New Answer View All Answers
What are # preprocessor operator in c?
What is meant by int main ()?
Why is it usually a bad idea to use gets()? Suggest a workaround.
What are integer variable, floating-point variable and character variable?
Explain what are reserved words?
Is it possible to pass an entire structure to functions?
What are c preprocessors?
Explain the term printf() and scanf() used in c language?
Explain two-dimensional array.
What is a global variable in c?
What oops means?
What is dynamic variable in c?
What is a protocol in c?
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34