To generate the series 1+3+5+7+... using C program
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
write a profram for selection sort whats the error in it?
difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?
void main() { int i=5; printf("%d",i+++++i); }
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
Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL
write the value of x and y after execution of the statements: int x=19,y; y=x++ + ++x; x++; y++;
How to develop a program using C language to convert 8-bit binary values to decimals. TQ
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.
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............
What are the different types of errors in C and when they occur?
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.
quoroum of computer languages?