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 c-programe that input one number of four digits and find digits sum?
#include<>stdio.h> #include<>conio.h> { printf("hello"); void main() getch(); } what the out put of this program and why ......plz clear my answer
Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL
which typw of errors ? & how to solve it ?
what is the error in the following code: main() { int i=400,j; j=(i*i)/i; }
#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }
Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. It Says: Cube undeclared what should i do? Please help \thanks in advanced #include<stdio.h> #include<math.h> #include<conio.h> main( ) { float x,y; while(x++<10.0) { printf("Enter Number:"); scanf("%d", &x); y = cube(x); printf("%f %f %f \n", x,pow(x,2),y); cube(x); } { float x; float y; y = x*x*x; } getch(); return (y); }
how tally is useful?
what is syntax error?
To generate the series 1+3+5+7+... using C program
how to convert decimal to hexadecimal without using arrays just loops
Using string functions write a program that will accept the name of the capital as input value and will display the corresponding country. ------------------------ Capitals Countries ------------------------ Capitals Countries Ottawa Canada Moscow Russia Rome Italy I can't not get it to run properly