To generate the series 1+3+5+7+... using C program

Answers were Sorted based on User's Feedback



To generate the series 1+3+5+7+... using C program..

Answer / shiva

for(int a=0;a<10;a++){
(a&1)?printf("%d\n",a):printf("\n");
}

Is This Answer Correct ?    8 Yes 6 No

To generate the series 1+3+5+7+... using C program..

Answer / nasif

#include<stdio.h>
int main()
{
int n,i,d=1,sum=0;
scanf("%d", &n);
for(i=1;i<=n;d=d+2){
sum=sum+d;
i++;
}
printf("summation is %d", sum);
return 0;
}

Is This Answer Correct ?    1 Yes 0 No

To generate the series 1+3+5+7+... using C program..

Answer / meheka

#inclined <stdio.h>
int main ()
{
int I=1,n,sum=0;
scanf("%d",&n);
while(i<=n)
sum=sum+I;
{
printf("%d",sum);
I=I+2;
}
return 0:

Is This Answer Correct ?    1 Yes 0 No

To generate the series 1+3+5+7+... using C program..

Answer / beetha poulose

#include<include>
int main ()
{
int j,i,n,sum=0;
Print("enter n");
scanf ("%d",&n);
For (i=1,j=1; j<=n; i=i+5,j++)
{
Sum=sum +i;
}
Prinrf ("sym=%d",sum);
Return 0;
}

Is This Answer Correct ?    1 Yes 0 No

To generate the series 1+3+5+7+... using C program..

Answer / nishant

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i=1,sum=0;
clrscr();
printf("enter the value for n:");
scanf("%d",&n);
while(i<=n)
{
sum=sum+i;
i=i+2;
}
printf("the series is =%d");
getch()
}

Is This Answer Correct ?    0 Yes 0 No

To generate the series 1+3+5+7+... using C program..

Answer / aditya parashar

#include<iostream.h>
void main ()
{int s,n;
cout <<"For finding sum of series
1+3+5.. till n terms enter value of n: ";
cin>>n;
s=n*n;
cout<<"
sum of series 1+3+5+.. till n
terms is: "<<s;
}
[Note:- only output matters]

Is This Answer Correct ?    0 Yes 0 No

To generate the series 1+3+5+7+... using C program..

Answer / medo

//*I know this is a different program but i want you to try
it!*//



#include <stdio.h>
void main()
{
int i,j;

for(i=1;i<=4;i++)
{
for(j=1;j<=8;j++)
{printf("* ");}
printf("\n");

for(j=1;j<=8;j++)
{printf(" *"); }
printf("\n");
}
}

Is This Answer Correct ?    7 Yes 8 No

To generate the series 1+3+5+7+... using C program..

Answer / parthibanselvaraj

the series seems to be infinite . so you need to restrict
it to some ceiling.

Is This Answer Correct ?    10 Yes 19 No

Post New Answer

More C C++ Errors Interview Questions

write a profram for selection sort whats the error in it?

2 Answers  


difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?

2 Answers   TCS,


void main() { int i=5; printf("%d",i+++++i); }

14 Answers   HCL,


Display this kind of output on screen. 1 0 1 1 0 1 3. Display this kind of output on screen. 1 1 0 1 0 1 4. Display this kind of output on screen. 1 1 0 1 0 1 5.Display this kind of output on screen. 1 2 3 4 5 6 7 8 9 10

1 Answers  


Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL

0 Answers  






write the value of x and y after execution of the statements: int x=19,y; y=x++ + ++x; x++; y++;

0 Answers  


How to develop a program using C language to convert 8-bit binary values to decimals. TQ

1 Answers   Amazon,


I can not get my C++ program to work right. It is supposed to tell if a word is a palindrome or not, but it only tells thet the word is not a palindrome. And I can't fix it.

1 Answers  


Answering Yes or No in C++...using only stdio.h and conio.h..........help me please...? here's must be the output of the program: Screen A Exam No. items Score 1 20 20 2 35 35 Another Entry? [Y] or [N] : Screen B: Record No. Student's Name: 1 Fernando Torres 2 Chuck Norris Note: if you press Y, the program must repeat the procedure in screen A, then if N, the program must proceed to the screen B....Please Help me out............

1 Answers  


What are the different types of errors in C and when they occur?

4 Answers  


loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program.

5 Answers   CMC,


quoroum of computer languages?

0 Answers   Infosys,


Categories