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

Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

1725


When should a type cast not be used?

613


What is the meaning of typedef struct in c?

579


What are the different types of control structures in programming?

650


What is signed and unsigned?

627






Do string constants represent numerical values?

899


With the help of using classes, write a program to add two numbers.

607


what is different between auto and local static? why should we use local static?

630


What does #pragma once mean?

673


Explain what are its uses in c programming?

581


An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode

597


Explain what are run-time errors?

595


Do variables need to be initialized?

611


What is the function of volatile in c language?

649


Where we use clrscr in c?

684