Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <bits/stdc++.h>
- using namespace std;
- int func1() {
- int temp = rand();
- if (temp % 2 == 0) {
- return temp;
- } else func1();
- }
- int func2() {
- int temp = rand();
- if (temp % 2 != 0) {
- return temp;
- } else func2();
- }
- int main()
- {
- int a[10][10]={};
- for (int i = 0; i < 10; i++) {
- for (int j = 0; j < 10; j++) {
- if (j % 2 == 0) {
- a[i][j] = func2();
- }
- if (j % 2 != 0) {
- a[i][j] = func1();
- }
- }
- }
- for (int i = 0; i < 10; i++) {
- for (int j = 0; j < 10; j++) {
- cout << a[i][j] << ' ';
- } cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement