SHARE
TWEET

Untitled

a guest Jun 12th, 2019 76 in 25 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Program
  2. {
  3.     static void Main()
  4.     {
  5.         // Loop over 2 variables at once.
  6.         for (int i = 0, x = 0; i < 10 && x >= -2; i++, x--)
  7.         {
  8.             System.Console.WriteLine("FOR: i={0}, x={1}", i, x);
  9.         }
  10.     }
  11. }
  12.  
  13.  
  14. public static void Main()
  15. {
  16.    int i,j,rows,k=1;
  17.  
  18.    Console.Write("Input number of rows : ");
  19.    rows= Convert.ToInt32(Console.ReadLine());    
  20.    
  21.    for(i=1;i<=rows;i++)
  22.    {
  23.     for(j=1;j<=i;j++)
  24.        Console.Write("{0} ",k++);
  25.     Console.Write("\n");
  26.    }
  27. }
  28.  
  29.  
  30. public static void Main()
  31. {
  32.     int num,r,sum=0,temp;
  33.    
  34.  
  35.     Console.Write("Input  a number: ");
  36.     num = Convert.ToInt32(Console.ReadLine()); 
  37.  
  38.     for(temp=num;num!=0;num=num/10){
  39.          r=num % 10;
  40.          sum=sum+(r*r*r);
  41.     }
  42.     if(sum==temp)
  43.          Console.Write("{0} is an ??? number.\n",temp);
  44.     else
  45.          Console.Write("{0} is not an ??? number.\n",temp);
  46.     }
  47. }
  48.  
  49.  
  50. public static void Main()
  51. {
  52.     int num,r,sum=0,t;
  53.    
  54.     Console.Write("Input a number: ");
  55.     num = Convert.ToInt32(Console.ReadLine());  
  56.  
  57.     for(t=num;t!=0;t=t/10)
  58.     {
  59.          r=t % 10;
  60.          sum=sum*10+r;
  61.     }
  62.     Console.Write("The number: {0} \n",sum);
  63. }
  64.  
  65.  
  66. public static void Main()
  67. {
  68.     int num,r,sum=0,t;
  69.    
  70.     Console.Write("Input a number: ");
  71.     num = Convert.ToInt32(Console.ReadLine());  
  72.  
  73.     for(t=num;num!=0;num=num/10){
  74.          r=num % 10;
  75.          sum=sum*10+r;
  76.     }
  77.     if(t==sum)
  78.          Console.Write("{0} is a ??? number.\n",t);
  79.     else
  80.          Console.Write("{0} is not a ??? number.\n",t);
  81.     }    
  82. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top