c program to manipulate x=1+3+5+...+n using recursion
Answer Posted / boni ravi
#include<stdio.h>
#include<conio.h>
main()
{
int i,n;
int x=0;
clrscr();
printf("enter n value");
scanf("%d",&n);
for(i=1;i<=n;i=i+2)
{
x=i+x;
}
printf("output is%d",x);
}
Is This Answer Correct ? | 9 Yes | 10 No |
Post New Answer View All Answers
What is a struct c#?
Write a program to swap two numbers without using third variable in c?
How can you increase the size of a dynamically allocated array?
What is oops c?
Write a program to print factorial of given number without using recursion?
Explain what is wrong in this statement?
Why is #define used?
What is the purpose of clrscr () printf () and getch ()?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
In a switch statement, explain what will happen if a break statement is omitted?
Explain how do you determine a file’s attributes?
I have seen function declarations that look like this
What is the size of enum in c?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?