please give code for this 1 2 4 7 11 16

Answer Posted / sai

#include<stdio.h>
#include<conio.h>
void main()
{
int s=1,i,n;
printf("enter a number
");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
s=s+i;
printf("%3d",s);
}
getch;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain continue keyword in c

586


Write a program with dynamically allocation of variable.

604


What is function and its example?

626


What is string function c?

568


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

713






which type of aspect you want from the student.

1701


what are # pragma staments?

1629


please send me the code for multiplying sparse matrix using c

1726


A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?

1511


What is bash c?

558


Can we add pointers together?

620


What does sizeof return c?

605


How to delete a node from linked list w/o using collectons?

2089


Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.

2649


Difference between goto, long jmp() and setjmp()?

708