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 |
what will be the result of the following program ? char *gxxx() { static char xxx[1024]; return xxx; } main() { char *g="string"; strcpy(gxxx(),g); g = gxxx(); strcpy(g,"oldstring"); printf("The string is : %s",gxxx()); } a) The string is : string b) The string is :Oldstring c) Run time error/Core dump d) Syntax error during compilation e) None of these
What is the c value paradox and how is it explained?
What header files do I need in order to define the standard library functions I use?
write a program to print data of 5 five students with structures?
difference between native and cross compilers
what is software?
write a program to check whether a given integer is a strong number or not? [Hint: 145=1!+4!+5! =1+24+120 =145]
What are qualifiers in c?
int i=0,j; j=++i + ++i ++i; printf(" %d",j);
What are different types of variables in c?
What is a protocol in c?
in which language c language is written?