c program to manipulate x=1+3+5+...+n using recursion
Answer Posted / naresh m
main()
{
int sum=0,i;
int p,n;
printf("enter value for n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
p=(i*2-1);
sum=sum+p;
}
printf("sum is %d",sum);
}
| Is This Answer Correct ? | 2 Yes | 5 No |
Post New Answer View All Answers
What is C language ?
How do I use strcmp?
Explain function?
What is the role of this pointer?
Explain 'bit masking'?
write a c program to find the sum of five entered numbers using an array named number
What are the advantages of external class?
Why c is called a mid level programming language?
What is the meaning of typedef struct in c?
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
What 'lex' does?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
What do you mean by command line argument?
Was 2000 a leap year?
What is the full form of getch?