c program to manipulate x=1+3+5+...+n using recursion
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
How can I do serial ("comm") port I/O?
Can you assign a different address to an array tag?
c programming of binary addition of two binary numbers
What is the explanation for the dangling pointer in c?
what is the defrenece between structure and union
What are categories used for in c?
What is calloc()?
How do shell structures work?
how to TOGGLE Nth bit of variable in a MACRO
which of the function operator cannot be over loaded a) <= b)?: c)== d)*
10 Answers Cisco, CTS, Google, HCL, HP,
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
How pointer is different from array?