answersLogoWhite

0

You really need some nested loops; but some programming languages might allow you to write this as one statement.

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

How to write a Program of printing prime numbers between 1 to 500 in 1 statement only?

Good luck with that one, I don't think it's possible as it would have to count the positive integer factors which exist between 1 and the value of half of each number, if the count becomes greater than two then continue to the next number (i.e it isn't a prime number). It is maybe possible in a single compound statement but I don't think that is what you are after.


How do you write a VBnet program to find the prime numbers between 100 to 200?

VBnet program to find the prime numbers between 100 to 200?


Write a program large number and small number among n numbers by using If statement?

12


Q2 Write a program to print even numbers between 10 and 50?

You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.


Is this statement true All real numbers are irrational numbers?

No. The statement is wrong. It does not hold water.


What are all the whole numbers between 1 to 1000000000?

All of the whole numbers between one and a billion. Honestly, we're not robots here. Write a program and do it yourself, if you really need them.


Do you need statement numbers in QBASIC?

Statement numbers were a feature of BASIC, and while QBASIC supports them, they are by no means necessary.


How can you accept sum and print numbers without creating variables?

It is very easy. The program begins here..... /*Program to sum and print numbers without creating variables*/ #include<stdio.h> main() { clrscr(); printf("%d+%d=%d",5,2,5+2); getch(); } /*Program ends here*/ Now just by changing the numbers in the "printf" statement we can add, subtract, multiply and divide the numbers without using variables. Hence the problem is solved..........


Are some rational numbers integers?

That's a true statement. Another true statement is: All integers are rational numbers.


What are numbers in a multiplication statement?

a factor


What is the c plus plus program for printing sum to n natural numbers?

main() { int i, n, sum=0; cout<<"Enter the limit"; cin>>n; for(i=0;i<=n;i++) sum=sum+i; cout<<"sum of "<<n<<" natural numbers ="<<sum; getch(); }


What can be a statement for rational numbers?

Rational numbers represent a tiny part of real numbers.