0

Hey guys! Can someone teach me how to generate even,odd and prime numbers in flowchart? Thanks in advance😊

21st Jul 2017, 11:50 AM
Aloha Mae Rondina
Aloha Mae Rondina - avatar
4 Antworten
+ 2
use 'for' loop or 'while' loop 1. using for loop for(int i=0; i<11; i+=2) { cout << "even numbers = "<< i << endl; // shows even number } 2. using while loop int a=1 while(a<11) { cout << "Odd numbers = " << a; a+=2; //shows odd number }
21st Jul 2017, 12:39 PM
‎ ‏‏‎Anonymous Guy
+ 1
//for prime num use 'for' loop int i,a,b; cin >> a; for(i=2;i <a;i++){ b=a%i; if(b==0){ cout << "Its not a prime number"; } break; } if(b!=0) {cout << "It's a prime number";}
22nd Jul 2017, 2:39 PM
‎ ‏‏‎Anonymous Guy
0
@Sreejit Subhash how about prime numbers?
22nd Jul 2017, 7:58 AM
Aloha Mae Rondina
Aloha Mae Rondina - avatar
0
@Sreejith Thanks a lot!😀
23rd Jul 2017, 1:12 AM
Aloha Mae Rondina
Aloha Mae Rondina - avatar