please give code for this 1 2 4 7 11 16
Answers were Sorted based on User's Feedback
Answer / 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 ? | 98 Yes | 51 No |
Answer / kiran
#include<stdio.h>
#include<conio.h>
void main()
{
int p=1;
for(int i=1;i<=5;i++)
{
printf("%d ",p);
p+=i;
}
getch();
}
| Is This Answer Correct ? | 35 Yes | 23 No |
Answer / ashis 6
#include<studio.h>
#include<conio.h>
Void main()
{
Int x,y;
Y=0;
For(x=1;x<=6;x++)
{
Printf("%d",y);
Y=x+y
}
| Is This Answer Correct ? | 9 Yes | 5 No |
Answer / 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 |
Answer / santhoshreddy katam
#include<stdio.h>
#include<conio.h>
void main()
{
int a=1;
for(int i=0;i<=5;i++)
{
a=a+i;
printf("%d/n", a);
getch();
}
}
| Is This Answer Correct ? | 36 Yes | 40 No |
Answer / ashish tiwari
#include<stdio.h>
#include<conio.h>
void main()
{
int p=1,i;
for(i=1;i<=6;i++)
{
printf("%d ",p);
p+=i;
}
getch();
}
| Is This Answer Correct ? | 4 Yes | 8 No |
Answer / aditya
#include<stdio.h>
int main()
{
int fir=1,nex=0;
for(nex=0;nex<6;nex++)
{fir=fir+nex;
printf("%d ",fir);
}}
| Is This Answer Correct ? | 3 Yes | 8 No |
Answer / mohan
#include<stdio.h>
void main(){
int i,j=1;
printf("%d\t",j);
for(i=1;i<6;i++){
j=j+i;
printf("%d\t",j);
}
}
| Is This Answer Correct ? | 6 Yes | 13 No |
What is sizeof array?
How can you increase the allowable number of simultaneously open files?
what is different between auto and local static? why should we use local static?
Describe newline escape sequence with a sample program?
What is the difference between abs() and fabs() functions?
What is meant by gets in c?
Write a c program to print the sizes and ranges of different data types in c?
What are the types of assignment statements?
What is variable declaration and definition in c?
How to add two numbers with using function?
What is #line used for?
print ur name 20,000 times without using inbuilt library functions like printf,scanf,gets,puts,getchar or putchar