C++
Відкрити в Telegram
گروه آموزش زبان برنامه نویسی سی، سی پلاس پلاس خدمت شما دوستداران گرامی با امید بهره بردن و موفقیت شما همراهان🌹 ممنون که همراه ما میشین و ما رو حمایت میکنین 🌹 https://t.me/ourcpp
Показати більше2 130
Підписники
-224 години
-57 днів
-4730 день
Архів дописів
2 130
۹-برنامه چاپ مجموع و میانگین ۱۰ عدد صحیح ورودی:
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int i,x;
float sum=0,avg;
for(i=1;i<=10;i++)
{
cout<<"Enter "<<i<< " number : ";
cin>>x;
sum+=x;
}
cout<<endl<<"sum is = "<<sum<<endl;
avg=sum/10;
cout<<endl<<"average is = "<<avg;
getch();
return 0;
}
2 130
۸-برنامه چاپ جدول ضرب اعداد ۱ تا ۱۰:
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int i,j;
for(i=1;i<=10;i++)
{
for(j=1;j<=10;j++)
{
cout<<i*j<<"\t";
}
}
getch();
return 0;
}
2 130
۷-برنامه چاپ ستاره از چپ به راست:
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
cout<<"*";
}
cout<<endl;
}
getch();
return 0;
}
2 130
۶-چاپ Hello world :
#include <iostream>
#include <conio.h>
using namespace std ;
int main ()
{
cout<<"Hello world " ;
getch() ;
return 0;
}
2 130
۵-چاپ ستاره از راست به چپ:
#include <iostream>
using namespace std;
int main()
{
for(int i = 1 ; i <= 5 ; i++)
{
for(int j = 5 ; j > i ; j--)
cout<<" ";
for(int k = 1 ; k <= i ; k++
cout<<"*";
cout<<"\n";
}
return 0;
}
2 130
۴-چاپ اعداد ۱ تا ۱۰۰
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int a;
for (a=1;a<100;a++)
{
cout << a<< endl;
}
getch();
return 0;
}
2 130
۳-جمع دو عدد
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int a , b ,c;
cout << "a =";
cin >> a;
cout << "b=" ;
cin >> b;
c= a+b;
cout<< "c=" << c ;
getch ();
return 0;
}
2 130
۲-زوج و فرد بودن یک عدد
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int a;
cout <<"a=";
cin>>a;
if (a%2==0)
cout <<"zog";
else
cout <<"fard";
getch();
return 0;
}
2 130
۱-محیط و مساحت مستطیل
#include <iostream>
#include <conio.h>
using namespace std ;
int main()
{
int tool,arz,masahat,mohit;
cout <<"enter number of tool=";
cin>>tool;
cout <<"enter number af arz =";
cin>> arz;
mohit =(tool+arz)*2;
cout <<"mohit ="<<mohit<<endl;
masahat = tool*arz;
cout<<"masahat="<<masahat;
getch();
return 0;
}
