Вы находитесь на странице: 1из 9

Student: Kosaly Fariza

Group: IT2-2007
-------------------------------------------

Integer 3 ��� ������ ����� � ������. �������� ������� ������ ������, �����
���������� ������ ����������, ������� �������� ������ ���� (1 �������� = 1024
�����).

#include <iostream>
#include <string>

using namespace std;

int main()
{
int a,b;
cout<<"File size per byte:";
cin>>a;
b=a/1024;

cout<<"The file size by kilobyte :"<<b<<endl;

return 0;
}
----------------------------------------------------------------
Integer 4 ���� ����� ������������� ����� A � B (A > B). �� ������� ���- �� A
��������� ����������� ��������� ���������� �������� ����� B (��� ���������).
�������� ������� ������ ������, ����� ���������� �������� B, ����������� �� �������
A.

#include <iostream>
#include <string>

using namespace std;

int main()
{
int a,b,c;
cout<<"A:";
cin>>a;
cout<<"B:";
cin>>b;
c=a/b;
if (a>b) {
c=a/b;
cout<<"c:"<<c<<endl;
}
else {
cout<<"B bolshe A:"<<endl;
}
return 0;
}
-----------------------------
Integer 9 ���� ����������� �����. �������� ���� ������� ������ ������,
������� ����� ����� ������� ����� (�����).

#include <iostream>
#include <string>

using namespace std;

int main()
{
int a,b;
cout<<"A:";
cin>>a;
b=a/100;

cout<<"B:"<<b<<endl;
return 0;
}
------------------------------------------
integer 12 ���� ����������� �����. ������� �����, ���������� ��� ������-
��� ��������� ����� ������ ������.

#include <iostream>
#include <string>

using namespace std;

int main()
{
int a,b,c;
cout<<"A:";
cin>>a;
c=a/100;
b=a%10;
a=a%100;
a=a/10;

cout<<b<<a<<c<<endl;
return 0;
}
---------------------------------
Integer 13 ���� ����������� �����. � ��� ���������� ����� ����� ����� �
��������� �� ������. ������� ���������� �����.

#include <iostream>

#include <string>

using namespace std;

int main()

int a;
cin>>a;

cout<<a%10<<a%100/10;

return 0;

}
------------------------------------
Integer 15 ���� ����������� �����. ������� �����, ���������� ��� �������- �����
���� ����� � ������� ��������� ����� (��������, 123 �������� � 213).

#include <iostream>
#include <string>

using namespace std;

int main()
{
int a,b,c;

cin>>a;

b=a/100;
c=a%10;
a=a%100/10;

cout<<a<<b<<c<<endl;

return 0;
}

-----------------------------------
Integer 20 � ������ ����� ������ N ������ (N � �����). ����� ���������� ������
�����, ��������� � ������ �����.

#include <iostream>
#include <string>

using namespace std;

int main()
{
int n,a;
cout<<"N:";
cin>>n;
a=n/60;
if (n<=86600 || n>0 ) {
a=n/60;
cout<<"Minute:"<<a<<endl;
}
else {
cout<<"no!"<<endl;
}

return 0;
}
-------------------------------------------
Integer 23 � ������ ����� ������ N ������ (N � �����). ����� ���������� ������
�����, ��������� � ������ ���������� ����.

#include <iostream>
#include <string>

using namespace std;

int main()
{
int n,a;
cout<<"N:";
cin>>n;

a=n/60;
if (n<=86600 && n>0 ) {
a=n/30;
cout<<"Minute:"<<a<<endl;
}
else {
cout<<"no!"<<endl;
}

return 0;
}
-------------------------------------------------
Integer 26 ��� ������ ������������� �������� �������: 1 � ��������- ���, 2 �
�������, . . . , 6 � �������, 7 � �����������. ���� ����� ����� K, ������� �
��������� 1�365. ���������� ����� �� ������ �� K-�� �� ����, ���� ��������, ��� �
���� ���� 1 ����� ���� ���������.

#include <iostream>
#include <string>

using namespace std;

int main(){
int k,a;
cout << "a:";
cin>>a;

k = a % 7;
switch (k){

case 1:
cout << "is tuesday";
break;
case 2:
cout << "is wednesday";
break;
case 3:
cout << "is thurday";
break;
case 4:
cout << "is friday";
break;
case 5:
cout << "is saturday";
break;
case 6:
cout << "is sunday";
break;
case 7:
cout << "is monday";
break;
default:
break;
}

return 0;
}

-----------------------------------------------
Integer 28 ��� ������ ������������� �������� �������: 1 � ��������- ���, 2 �
�������, . . . , 6 � �������, 7 � �����������. ���� ����� ����� K, ������� �
��������� 1�365, � ����� ����� N, ������� � ��������� 1�7. ���������� ����� ��
������ �� K-�� �� ����, ���� ��������, ��� � ���� ���� 1 ����� ���� ���� ������ �
������� N.

#include <iostream>
#include <string>

using namespace std;

int main(){
int k,n,a,b;
cout << "input n(1-7):";
cin>>a;
cout<<"input k(1-365):";
cin>>b;
n = a % 7;
k=(n+b-1)%7;
switch (k){
case 1:
cout << "is monday";
break;
case 2:
cout << "is tuesday";
break;
case 3:
cout << "is wednesday";
break;
case 4:
cout << "is thurday";
break;
case 5:
cout << "is friday";
break;
case 6:
cout << "is saturday";
break;
case 7:
cout << "is sunday";
break;

default:
break;
}

return 0;
}
--------------------------------------------
Integer 29 ���� ����� ������������� ����� A, B, C. �� ������������� ���- ���� A ?
B ��������� ����������� ��������� ���������� ��������� �� �������� C (���
���������). ����� ���������� ���������, ����������� �� �������������, � �����
������� �������� ����� �������������.

#include <iostream>
#include <string>

using namespace std;

int main()
{
int a,b,c,s1,v,s2,s3;
cout<<"Enter A:";
cin>>a;
cout<<"Enter B:";
cin>>b;
cout<<"Enter C:";
cin>>c;
s1=a*b;
s2=pow(c,2);
v=s1/s2;
s3=s1-s2;

cout<<"S:"<<v<<endl<<"empty space:"<<s3<<endl;
return 0;

}
------------------------------
Integer 30 ��� ����� ���������� ���� (����� ������������� �����). ����- ������
�������������� ��� ����� �������, �������, ���, � �������, ������� 20 ������� ���
1901 ���.

#include <iostream>

#include <string>

using namespace std;

int main()

int a,b;

cout<<"Year:";

cin>>a;

b=a/100+1;

cout<<"Century:"<<b<<endl;

return 0;

Вам также может понравиться