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
Is fortran still used in 2018?
Is c procedural or object oriented?
What is page thrashing?
Write programs for String Reversal & Palindrome check
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
c language interview questions & answer
What is dynamic variable in c?
Apart from dennis ritchie who the other person who contributed in design of c language.
Is c procedural or functional?
In C, What is the #line used for?
What does void main return?
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
What is adt in c programming?
Is null equal to 0 in sql?