please give code for this 1 2 4 7 11 16

Answers were Sorted based on User's Feedback



please give code for this 1 2 4 7 11 16..

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 ?    97 Yes 50 No

please give code for this 1 2 4 7 11 16..

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 ?    34 Yes 21 No

please give code for this 1 2 4 7 11 16..

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 ?    8 Yes 4 No

please give code for this 1 2 4 7 11 16..

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

please give code for this 1 2 4 7 11 16..

Answer / sai

sk rider

Is This Answer Correct ?    0 Yes 1 No

please give code for this 1 2 4 7 11 16..

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

please give code for this 1 2 4 7 11 16..

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

please give code for this 1 2 4 7 11 16..

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

please give code for this 1 2 4 7 11 16..

Answer / guest

1 10 100 111 1011 1111

Is This Answer Correct ?    6 Yes 12 No

please give code for this 1 2 4 7 11 16..

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

Post New Answer

More C Interview Questions

main() { int i; printf("%d",i^i); }

1 Answers  


What is true about the following C Functions (a) Need not return any value (b) Should always return an integer (c) Should always return a float (d) Should always return more than one value

2 Answers   DynPro, TCS,


What are the Advantages of using macro

0 Answers  


#include<stdio.h> main() { char s1[]="Ramco"; char s2[]="Systems"; s1=s2; printf("%s",s1); } Find the output

5 Answers   CitiGroup,


what is the use of #pragma pack, wer it is used?

2 Answers   Wipro,






In which category does main function belong??

5 Answers  


#include <stdio.h> #define sqr(x) (x*x) int main() { int x=2; printf("value of x=%d",sqr(x+1)); } What is the value of x?

16 Answers   Accel Frontline, Opera, Oracle,


Explain which function in c can be used to append a string to another string?

0 Answers  


main() { int a,b; printf("%d,%d",scanf("%d%d",&a,&b)); } => do u mean above program's output... =>output will be:2,whatever you enter value for b. =>because scanf is a library fn which will return how many arguements it processes, and second value you are right mr.Satya but i found my self unable to understand that for the first time scanf returns the no of successful matches but how for the second time it returns the value of 'b'.while a function should return the same 'r' value every time.

1 Answers   Cisco,


What will be the result of the following program? main() { char p[]="String"; int x=0; if(p=="String") { printf("Pass 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } else { printf("Fail 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } } a) Pass 1, Pass 2 b) Fail 1, Fail 2 c) Pass 1, Fail 2 d) Fail 1, Pass 2 e) syntax error during compilation

10 Answers   IBM,


Question 1: You want to conduct a survey within your classroom, on the quality of canteen’s food. You ask each of your class fellows to rank the quality of food between 1 and 5 (1 representing excellent quality and 5 representing worst quality). During the survey, you make a list containing the roll# of student and the opinion given by that student. The list can be as follow Roll # Opinion 234 1 235 1 236 5 237 1 238 2 239 3 240 5 241 5 242 1 To get the results of the survey, you need to determine the frequency of each opinion value. The frequency of an opinion is determined by counting the number of students giving that opinion. For example, for the above list the frequency of opinion value 1 is 4 and frequency of opinion value 4 is 0. After getting the frequency of each opinion, you can easily judge about the quality of the food by seeing through the frequency of each opinion. You need to develop a program to calculate the results of this survey. The program inputs the opinion of 50 students and counts the frequency of each opinion. It then displays a report showing the frequency of each opinion. Sample output: Opinion Frequency Remarks 1 5 Excellent 2 10 Good 3 15 Normal 4 10 Bad 5 10 Really bad

1 Answers  


write a program to swap Two numbers without using temp variable.

75 Answers   EMC, Focus, GreyB, HCL, Hitech, HP, Huawei, Infosys, Mannar Company, Microsoft, Miles Software, Odessa Technologies, Satyam, TCS, Wipro,


Categories