Write a short code using c++ to print out all odd number from 1 to 100 using a for loop
Answer / Krishan Kumar
Here is a simple C++ code snippet that prints all odd numbers from 1 to 100 using a for loop:nn```cppnfor(int i = 1; i <= 100; ++i) {n if(i % 2 != 0) {n std::cout << i << ' ';n }n}n```
| Is This Answer Correct ? | 0 Yes | 0 No |
What is class invariant?
What is an incomplete type in c++?
What are virtual functions in c++?
What does the following code do: int c=0; cout< a) Undefined *Updated* b) 01 c) 00
#include<iostream.h> void main() { class x { public: int func(int) { cout<<"cool"; return 1; } } }
What is the output of the following program? Why?
What happens when the extern "c" char func (char*,waste) executes?
What is the prototype of printf function?
write a program that takes 5 digit no and calculate 2 power that no and print it.
Incase of a function declaration, what is extern means?
What is a template in c++?
Can member functions be private?