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 gets() function?
Write a program to swap two numbers without using the third variable?
What the different types of arrays in c?
Evaluate the following: int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } for fn(7); 1) 10 2) 11 3) 1
Can static variables be declared in a header file?
Explain how can type-insensitive macros be created?
In which category does main function belong??
Explain logical errors? Compare with syntax errors.
Tell us two differences between new () and malloc ()?
Why static is used in c?
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?
swap 2 numbers without using third variable?