Write a C program to print 1 2 3 ... 100 without using
loops?
Answer Posted / uma maheswari
#include<stdio.h>
#include<conio.h>
int i=1;
void main()
{
i<=100 ? printf("%d\n",i) : getch(); //conditional operator
i++;
main(); //recursive calling of main() function
}
| Is This Answer Correct ? | 10 Yes | 7 No |
Post New Answer View All Answers
How can I rethow can I return a sequence of random numbers which dont repeat at all?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
What are the different properties of variable number of arguments?
What is sizeof int in c?
What is a stream in c programming?
What are pointers?
What does void main () mean?
What is a example of a variable?
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
Why is it important to memset a variable, immediately after allocating memory to it ?
What is an auto variable in c?
Differentiate between #include<...> and #include '...'
Can true be a variable name in c?
Sir i need notes for structure,functions,pointers in c language can you help me please