bouchnina

Untitled

May 25th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. /*****************************************
  2. Do Not Forget To Like Our Page On Facebook
  3. Name : Langage C
  4. Link : http://www.facebook.com/MOBY.c00
  5. Enjoy !!
  6. ****************************************/
  7.  
  8. // NB: Exemple d execution en ligne ::
  9. // http://ideone.com/5qkNr7
  10.  
  11. using System;
  12.  
  13. public class HelloWorld {
  14.    static public void Main() {
  15.       int NombreEntree=45,Somme;
  16.  
  17.      
  18.       for(int i=1;i<NombreEntree;i++){
  19.    Somme=0;
  20.     for(int j=i;j<NombreEntree;j++){    
  21.         Somme+=j;
  22.         if(Somme==NombreEntree){
  23.                 Console.Write(NombreEntree+" = ");
  24.                 for(int k=i;k<=j;k++){
  25.                 if(k==j)        {Console.Write(k+"\n"); break;}
  26.                 Console.Write(k+" + ");
  27.                 }
  28.         }
  29.         }
  30. }
  31.    }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment