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 <iostream>
- using namespace std;
- int main()
- {
- cout<<"Hello World"<<endl;
- //for ( initialization ; condition checking ; change (increment/ decrement) )
- // for( int i = 100 ; i > 0 ; i = i/2 ){
- // cout << i << endl ;
- // }
- // int i = 5;
- // for( ; ; i++ ){
- // cout << i << endl ;
- // }
- int i = 0 ;
- // false = 0 (int)
- // true = any non zero value (int)
- // while (true) {
- // }
- do{
- cout<<i<<endl;
- } while(i>1);
- int num = 13 ;
- if (num%4 == 0){ // (0 == 0)
- cout<< "num "<< num <<" is divisible by 4"<<endl;
- }
- cout<<"shesh"<<endl;
- int marks = 80 ;
- if(marks > 70){
- cout <<"a+" << endl;
- }
- else if( marks >=50 ){
- cout <<"b+" << endl;
- }
- else{
- cout << "f" << endl;
- }
- char gender = 'F';
- if (gender == 'M' ){
- cout<<"male"<<endl;
- }
- else if (gender == 'F') {
- cout<< "female"<<endl;
- }
- else {
- cout<< "invalid"<<endl;
- }
- int counter = 0 , n = 4;
- for(int i = 0 ; i < n ; i++){
- cout<<"outer loop i = "<< i << endl;
- for(int j = 0 ; j < n ; j++){
- counter++;
- cout << "inner loop j = " << j << " counter "<<counter<< endl;
- }
- }
- cout<< counter <<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement