please give code for this 1 2 4 7 11 16

Answer Posted / yogesh sharma

Try this.

#include<stdio.h>
void main()
{
int a=1,b,i=0;
while(i<=5)
{
a=a+i;
printf("%d \n",a);
i++;
}
getch();
}

Is This Answer Correct ?    97 Yes 50 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

define string ?

669


What is wrong with this initialization?

593


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

603


What does p mean in physics?

584


What is binary tree in c?

622






Can the curly brackets { } be used to enclose a single line of code?

715


What is string constants?

662


What are reserved words?

656


Why dont c comments nest?

621


What functions are in conio h?

660


What are the types of bitwise operator?

665


how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

2725


Explain the difference between malloc() and calloc() in c?

578


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

15504


Why is extern used in c?

612