Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Exercice 2
- #include <stdio.h>
- #include <stdlib.h>
- void Remplacer(int t[],int taille){
- int i,j;
- for(i=0;i<taille;i++){
- for(j=i;j<taille;j++){
- if(t[j]<t[i]) t[j]=t[i];
- }
- }
- for(i=0;i<taille;i++)
- printf("%d ",t[i]);
- }
- ///////////////////////////////////////////////////////
- //Ex 1
- #include <stdio.h>
- #include <stdlib.h>
- double fonctionCalcul(int n){
- double t[20];
- int i;
- t[0]=1,t[1]=1;
- for(i=2;i<=n;i++){
- t[i]=t[i-1]+(t[i-2]/2);
- }
- return t[n];
- }
- int main()
- {
- double tab[10];
- int i;
- tab[0]=1,tab[1]=1;
- for(i=2;i<10;i++){
- tab[i]=fonctionCalcul(i);
- }
- for(i=0;i<10;i++)
- printf("%.2f ",tab[i]);
- printf("\n\n");
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment