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 string length in c?
Describe how arrays can be passed to a user defined function
How do we print only part of a string in c?
What is difference between array and pointer in c?
main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above
What is the modulus operator?
Explain enumerated types in c language?
What are the differences between Structures and Arrays?
What are qualifiers in c?
Can we replace the struct function in tree syntax with a union?
how to make a scientific calculater ?
Can include files be nested?
What is data types?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What is a example of a variable?