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 is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
21 Answers ADITI, Student, TCS,
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
What is methods in c?
how to execute a program using if else condition and the output should enter number and the number is odd only...
How can I write a function analogous to scanf?
To find whether a number is even or odd without using any conditional operator??
12 Answers College School Exams Tests, IBM,
What is the difference between array and structure in c?
Explain what is the difference between the expression '++a' and 'a++'?
# define prod(a,b)=a*b main() { int x=2; int y=3; printf("%d",prod(x+2,y-10)); } the output of the program is a.8 b.6 c.7 d.none
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 5 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
the maximum value that an integer constant can have is a) -32767 b) 32767 c) 1.701e+38 d) -1.7014e+38
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year