# To print natural numbers from 1 to 32767

asked Jul 2, 2018
closed Jun 14
main()
{
int i=1;
while(i<=32767)
{
printf("\n %d",i);
i=i++;
}
}
closed with the note: Since it as been answered.

answered Jul 2, 2018 by (140 points)

### }

answered Jul 4, 2018 by PRAVEEN
main()

{

for(int i=1;i<=32767;i++)

{

printf("%d",i);

}
commented Oct 7, 2018 by (120 points)
1 WILL BE PRINTED 32767 TIMES ITS A LOOP
commented Jun 11 by (7,830 points)
No, it will print all the integral numbers from 1 til 32767 (inclusive) just fine.
answered Jul 4, 2018 by anonymous
#include<stdio.h>
int main()
{
long long int i=1;
while(i<=32767)
{

i++;
}
printf("\n %lld",i);
}
+1 vote
answered Jul 4, 2018 by (170 points)
#include <iostream>

using namespace std;

int main()
{
for(long int i=1;i<=32767;i++)
cout<<i<<"\t";

return 0;
}
+1 vote
answered Jul 6, 2018 by anonymous
#include <iostream>

using namespace std;

int main()
{
int limit = 32767;
int x = 1;
while(x <= 32767)
{
cout << x << endl;
x++;
}

return 0;
}
answered Jul 6, 2018 by (160 points)
main()

{

int i;

for(i=1;i<32767;i++)

printf("\t%d",i);

}
answered Jul 6, 2018 by (460 points)
#include<stdio.h>

main()

{

int  i,n;

printf("enter no.of natural numbers to print\n");

scanf("%d",&n);

for(I=1;i<=n;i++)

{

printf("%d\t",i);

}

}
answered Jul 6, 2018 by (460 points)
#include<stdio.h>

main()

{

int i,n;

printf("enter no.of natural numbers\n");

scanf("%d",&n);

do

{

i=1;

printf("%d\t",i);

I++;

}while(I>=n);

}
commented Jun 11 by (7,830 points)
This code has many problems.

1. It does not compile.
2. Assuming you meant 'i' when you wrote 'I' (variables are case sensitive, so they are not the same) the code compiles, but it prints '1' and terminates as long as 'n' is at least 3. If 'n' is less than 3, the loop never terminates, you've got an infinite loop printing '1' forever.
answered Jul 14, 2018 by (300 points)
#include<stdio.h>

main()

{

int i;

for(i=1;i<=32768;i++)

{
printf("\t%d",i);

}

}
answered Jul 14, 2018 by (300 points)
main()

{

int i;

for(i=1;i<=32768;i++)

{
printf("\t%d",i);

}

}