Write a program to print the following series
2 5 11 17 23 31 41 47 59 ...
Answers were Sorted based on User's Feedback
Answer / dixit
#include<stdio.h>
int main()
{
int i=0,j=0,c=0,ct=-1,n=0;
scanf("%d",&n);
printf("2 ");
for(i=4;i<100;i++)
{ c=1;
for(j=2;j<=i/2;j++)
{
if(i%j==0) c=0;
}
if(c!=0){ ct++;
if(ct%2==0 && n>1 ) {
printf("%d ",i);
n--;
}
}}
return 0;
}
| Is This Answer Correct ? | 8 Yes | 20 No |
Is there any data type in c with variable size?
What are dangling pointers? How are dangling pointers different from memory leaks?
Can a local variable be volatile in c?
what is ur strangth & weekness
0 Answers Cognizant, LG Soft, NetEnrich,
What is NULL pointer?
why in C,C++'s int size is 2 byte and .net(c#) int Size is 4 byte?
I have an array of 100 elements. Each element contains some text. i want to: append a star character to the end of every fifth element remove every second character from every tenth element, and… add a line feed (ascii 10) after the 30th character of every array element whose length is greater than 30 characters.
Can you write the algorithm for Queue?
0 Answers College School Exams Tests, TCS,
What is 02d in c?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
FIND THE OUTPUT IF THE INPUT IS 5 5.75 void main() { int i=1; float f=2.25; scanf("%d%f",&i,&f); printf("%d %f",,i,f); } ANSWER IS 5 AND 2.25 WHY?
Write a program to check whether a number is prime or not using c?