DEV Community

etibor2006
etibor2006

Posted on • Edited on

2 1

C ++

Biz bugun sonlarini kasr korinishida ishlashni o'rganamiz.

float eni,boyi;
  cin>> eni >> boyi;
  cout << setprecision(2)<< fixed << eni * boyi;

  return 0;
}
Enter fullscreen mode Exit fullscreen mode

Bu kodda esa to'rtburchakni boyi bilan enini topishini o'rganamiz.

 int eni,boyi;
  cout<<"to'rtburchakning enin kiriting:";
  cin>>eni;
  cout<<"to'rtburchakni boyini kiriting:";
  cin>>boyi;
  cout<<"tortbuchakni yuzi:" << eni * boyi;



  return 0;
}
Enter fullscreen mode Exit fullscreen mode

Bu kodda esa 2 xonali soni yonama-yon yozishni organamiz.

 int kun,oy;

  cin>>kun >> oy;
  cout<<"Birthday is ";
  cout<< setw(2) << setfill('0')<< kun <<'-';
  cout<< setw(2) << setfill('0') << oy <<'.';


  return 0;
}
Enter fullscreen mode Exit fullscreen mode
cout << "1!=" << 1*1 <<endl;
  cout <<"2!=" << 2*1 << endl;
  cout <<"3!=" << 3*2 << endl;
  cout << "4!=" << 4*6 << endl;
  cout << "5!=" << 5*24;


  return 0;
}
Enter fullscreen mode Exit fullscreen mode

Tekis oldidan sonin qo'yishni o'rganamiz.

cout << "1!=" << 1*1 <<endl;
  cout <<"2!=" << 2*1 << endl;
  cout <<"3!=" << 3*2 << endl;
  cout << "4!=" << 4*6 << endl;
  cout << "5!=" << 5*24;


  return 0;
}
Enter fullscreen mode Exit fullscreen mode

Dastlabki 10 taFibonaccisonlarini chop etishini o'rganamiz.

#include <iostream>
using namespace std;
int main (){
int a = 0;
int b = 1;
int c = a + b;
cout << a <<  ' '  << b << ' ' << c << ' ';
a = b;
b = c;
c = a + b;
cout << c << ' ';
a = b;
b = c;
c = a + b;
 cout << c << ' ';
a =b;
  b = c;
  c = a + b;
   cout << c << ' ';
  a =b;
  b = c;
  c = a + b;
    cout << c << ' ';
  a =b;
  b = c;
  c = a + b;
    cout << c << ' ';
  a =b;
  b = c;
  c = a + b;
   cout << c << ' ';
  a =b;
  b = c;
  c = a + b;

  cout << c << ' ';

return 0;
  }
Enter fullscreen mode Exit fullscreen mode

@dawroun

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay