Advertisement
abrar1

Untitled

Aug 20th, 2022
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Online C++ Compiler.
  4. Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15. cout<<"Hello World"<<endl;
  16.  
  17. //for ( initialization ; condition checking ; change (increment/ decrement) )
  18.  
  19. // for( int i = 100 ; i > 0 ; i = i/2 ){
  20.  
  21. // cout << i << endl ;
  22. // }
  23.  
  24. // int i = 5;
  25. // for( ; ; i++ ){
  26.  
  27. // cout << i << endl ;
  28. // }
  29.  
  30. int i = 0 ;
  31.  
  32. // false = 0 (int)
  33. // true = any non zero value (int)
  34.  
  35. // while (true) {
  36.  
  37. // }
  38.  
  39. do{
  40.  
  41. cout<<i<<endl;
  42.  
  43. } while(i>1);
  44.  
  45. int num = 13 ;
  46.  
  47. if (num%4 == 0){ // (0 == 0)
  48. cout<< "num "<< num <<" is divisible by 4"<<endl;
  49. }
  50.  
  51. cout<<"shesh"<<endl;
  52.  
  53. int marks = 80 ;
  54.  
  55. if(marks > 70){
  56. cout <<"a+" << endl;
  57. }
  58. else if( marks >=50 ){
  59. cout <<"b+" << endl;
  60. }
  61. else{
  62. cout << "f" << endl;
  63. }
  64.  
  65. char gender = 'F';
  66.  
  67. if (gender == 'M' ){
  68. cout<<"male"<<endl;
  69. }
  70. else if (gender == 'F') {
  71. cout<< "female"<<endl;
  72. }
  73. else {
  74. cout<< "invalid"<<endl;
  75. }
  76.  
  77.  
  78. int counter = 0 , n = 4;
  79. for(int i = 0 ; i < n ; i++){
  80. cout<<"outer loop i = "<< i << endl;
  81. for(int j = 0 ; j < n ; j++){
  82. counter++;
  83. cout << "inner loop j = " << j << " counter "<<counter<< endl;
  84. }
  85. }
  86.  
  87. cout<< counter <<endl;
  88.  
  89. return 0;
  90. }
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement