summaryrefslogtreecommitdiff
path: root/sem_2/HLIN202/TP/TP2
diff options
context:
space:
mode:
Diffstat (limited to 'sem_2/HLIN202/TP/TP2')
-rw-r--r--sem_2/HLIN202/TP/TP2/ex10/exo10-1bin0 -> 9293 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex10/exo10-2bin0 -> 9350 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp17
-rw-r--r--sem_2/HLIN202/TP/TP2/ex11/exo11bin0 -> 9293 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex11/exo11.cpp15
-rw-r--r--sem_2/HLIN202/TP/TP2/ex7/exo7bin0 -> 9294 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex7/exo7.cpp27
-rw-r--r--sem_2/HLIN202/TP/TP2/ex8/exo8bin0 -> 9297 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex8/exo8.cpp13
-rw-r--r--sem_2/HLIN202/TP/TP2/ex9/exo91bin0 -> 9293 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex9/exo91.cpp14
-rw-r--r--sem_2/HLIN202/TP/TP2/ex9/exo92bin0 -> 9293 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex9/exo92.cpp14
13 files changed, 100 insertions, 0 deletions
diff --git a/sem_2/HLIN202/TP/TP2/ex10/exo10-1 b/sem_2/HLIN202/TP/TP2/ex10/exo10-1
new file mode 100644
index 0000000..10b03c3
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex10/exo10-1
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex10/exo10-2 b/sem_2/HLIN202/TP/TP2/ex10/exo10-2
new file mode 100644
index 0000000..227f81c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex10/exo10-2
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp b/sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp
new file mode 100644
index 0000000..7f99fd5
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp
@@ -0,0 +1,17 @@
+#include<iostream>
+
+int main () {
+ int a=0, cpt=0, som=0;
+ float moy=0;
+ std::cout<<"Entrez des entiers ( rel ), ce programme donne le nombre d'entier positifs entres avant le premier negatif"<<std::endl;
+ while ( a >=0 ) {
+ std::cin>>a;
+ cpt += a>=0 ? 1:0;
+ moy += a>0 ? a : 0;
+ }
+ moy=moy/cpt;
+ std::cout<<"Vous avez entre "<< cpt<< " positif avant de rentrer un negatif"<<std::endl;
+ std::cout<<"La moyenne des donnes est : " << moy << std::endl;
+ return 0;
+}
+
diff --git a/sem_2/HLIN202/TP/TP2/ex11/exo11 b/sem_2/HLIN202/TP/TP2/ex11/exo11
new file mode 100644
index 0000000..991f7a0
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex11/exo11
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex11/exo11.cpp b/sem_2/HLIN202/TP/TP2/ex11/exo11.cpp
new file mode 100644
index 0000000..d4fd4b8
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex11/exo11.cpp
@@ -0,0 +1,15 @@
+#include<iostream>
+
+int main () {
+ int n, a;
+ float x,y;
+ std::cout<<"Entrez a et n, ce programme calcule la racine carre de a via l'algorithme de Heron D'Alexandrie, avec une precision n "<<std::endl;
+ std::cin >> a >>n;
+ x = a;
+ do {
+ y = x;
+ x = y/2 + a/(2*y);
+ std::cout<<x<<std::endl;
+ } while ( x-y < 1/n);
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP2/ex7/exo7 b/sem_2/HLIN202/TP/TP2/ex7/exo7
new file mode 100644
index 0000000..902f13c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex7/exo7
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex7/exo7.cpp b/sem_2/HLIN202/TP/TP2/ex7/exo7.cpp
new file mode 100644
index 0000000..05c0533
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex7/exo7.cpp
@@ -0,0 +1,27 @@
+#include <iostream>
+
+int main(){
+ int a,b,c,min,max;
+ std::cout<<"Entrez 3 entiers, ce programme donnera le minimum et le maximum des trois"<<std::endl;
+ std::cin>> a >> b >> c;
+ if ( a >= b && a >= c) {
+ max = a;
+ }
+ else if ( b >= a && b >= c ) {
+ max = b;
+ }
+ else if ( c >= a && c >= b ) {
+ max = c;
+ }
+ if ( a <= b && a <= c ) {
+ min = a;
+ }
+ else if ( b <= a && b <=c ) {
+ min = b;
+ }
+ else if ( c <= a && c <= b ) {
+ min = c;
+ }
+ std::cout << "Le max est : " << max << " Le min est : " << min << std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP2/ex8/exo8 b/sem_2/HLIN202/TP/TP2/ex8/exo8
new file mode 100644
index 0000000..3f2470c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex8/exo8
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex8/exo8.cpp b/sem_2/HLIN202/TP/TP2/ex8/exo8.cpp
new file mode 100644
index 0000000..7caa991
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex8/exo8.cpp
@@ -0,0 +1,13 @@
+#include <iostream>
+
+int main () {
+ int x,n,reslt;
+ std::cout<<" Entrez x puis n, ce programme calcule la valeur de x exposant n" << std::endl;
+ std::cin>> x >> n;
+ reslt = 1;
+ for ( int i=0; i < n; i ++) {
+ reslt = x * reslt;
+ }
+ std::cout << x << " exposant " << n << " vaut : " << reslt <<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP2/ex9/exo91 b/sem_2/HLIN202/TP/TP2/ex9/exo91
new file mode 100644
index 0000000..8960964
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex9/exo91
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex9/exo91.cpp b/sem_2/HLIN202/TP/TP2/ex9/exo91.cpp
new file mode 100644
index 0000000..da7ea97
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex9/exo91.cpp
@@ -0,0 +1,14 @@
+#include<iostream>
+
+int main () {
+ int n;
+ float reslt;
+ std::cout << " Entrez un enter n, ce programme calcule la somme des inverses de 1 a n" << std::endl;
+ std::cin >> n;
+ for (int i=1; i <= n; i ++) {
+ reslt += 1.0/i;
+ }
+ std::cout<<"Le resultat est : "<< reslt <<std::endl;
+ return 0;
+ }
+
diff --git a/sem_2/HLIN202/TP/TP2/ex9/exo92 b/sem_2/HLIN202/TP/TP2/ex9/exo92
new file mode 100644
index 0000000..b21cc8d
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex9/exo92
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex9/exo92.cpp b/sem_2/HLIN202/TP/TP2/ex9/exo92.cpp
new file mode 100644
index 0000000..9787e2f
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex9/exo92.cpp
@@ -0,0 +1,14 @@
+#include<iostream>
+
+int main () {
+ int n,deb;
+ float reslt;
+ std::cout << " Entrez un enter n et i, ce programme calcule la somme des inverses de 1/i a 1/n" <<std::endl;
+ std::cin >> n >> deb;
+ for (int i=deb; i <= n; i ++) {
+ reslt += 1.0/i;
+ }
+ std::cout<<"Le resultat est : "<< reslt <<std::endl;
+ return 0;
+ }
+