Write a C++ program without using any loop (if, for, while
etc) to print numbers from 1 to 100 and 100 to 1;
Answer Posted / ravi sagar
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i;
int j=100;
int c=0;
printf("1 to 100 then 99 to 1");
for(i=1;i<=100;i++;)
{ if (c==0)
{
printf("%d",i);
if(i==100)
{
c=1;
}
}
if(c==1)
{
j--;
printf("%d",j);
if(j==0)
{
break;
}
}
}
| Is This Answer Correct ? | 4 Yes | 11 No |
Post New Answer View All Answers
What is #include stdio h?
What is a newline escape sequence?
how to execute a program using if else condition and the output should enter number and the number is odd only...
Differentiate between static and dynamic modeling.
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
What is const and volatile in c?
How do you determine the length of a string value that was stored in a variable?
What does c mean?
Are comments included during the compilation stage and placed in the EXE file as well?
define string ?
What does %p mean c?
Do pointers store the address of value or the actual value of a variable?
What is the difference between array and linked list in c?
What is substring in c?
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer