12 Nisan 2013 Cuma

C# 2


 Console Klavyeden tek girilene kadar olan sayıları toplama

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int toplam = 0;
            int sayi = 0;
 
 
            for (; ; ) {
                Console.Write("Sayıyı Giriniz = ");
                sayi = Convert.ToInt32(Console.ReadLine());
                if (sayi % 2 != 0)
                {
 
                    break;
                }

Console Girilen 10 Sayı içersindeki Tek Olan sayıların Ortalamasını Bulma

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace on_sayidan_cit_olanlarin_ortalamasi
{
    class Program
    {
        static void Main(string[] args)
        {
            int sayac = 0;  
            double  sayi, toplam=0, ort;            
            for (int i = 0; i < 10; i++)
            {
                Console.Write("{0}.Sayı Giriniz = ",i+1);                
                sayi =double.Parse(Console.ReadLine());
                if (sayi % 2 != 0)  {
 
                    toplam += sayi;
                    sayac++;
                }
-----------------

Console Girilen Bir Sayının Bölen Sayısını Veren Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication16
{
    class Program
    {
 
        public static void bol(int sayi)
        {
            int c = 0;
            for (int i = 1; i <= sayi; i++)
            {
 
                if (sayi % i == 0)
                {
 
                    c++;
 
                }
---------------

Birden Elliye Kadar Beşe Tam Bölünen Sayıları Çarpan Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int sayac;
            int carp = 1;
 
            for (sayac = 5; sayac <= 50;)
            {
                carp *= sayac;
                Console.WriteLine(sayac + "  ");
                sayac += 5;
 
            }
            Console.WriteLine("Sayıların Toplamı = " + carp);
            Console.ReadLine();
        }
    }
}

Birden Ona Kadar ÜçeTam Bölünen Sayıları Çarpan Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int sayac;
            int carp = 1;
 
            for (sayac = 1; sayac <= 10; sayac++)
            {
                if (sayac % 3 == 0)
                {
                    carp *= sayac;
                    Console.WriteLine(sayac);
                }
 
            }
            Console.WriteLine("Uce Bolunen Sayilarin Carpimi = " + carp);
            Console.ReadLine();
 
        }
    }
}

Birden Ona Kadar İkiye Tam Bölünen Sayıları Çarpan Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int sayac;
            int carp = 1;
 
            for (sayac = 1; sayac <= 10; sayac++)
            {
                if (sayac % 2 == 0)
                {
                    carp *= sayac;
                    Console.WriteLine(sayac);
                }
 
            }
            Console.WriteLine("İkiye Bolunen Sayilarin Çarpımı = " + carp );
            Console.ReadLine();
 
        }
    }
}

 Birden Ona Kadar İkiye Tam Bölünen Sayıları Toplayan Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
 
            int sayac;
            int topla = 0;
 
            for (sayac = 1; sayac <= 10; sayac++)
            {
                if (sayac % 2 == 0)
                {
                    topla += sayac;
                    Console.WriteLine(sayac);
                }
 
            }
            Console.WriteLine("İkiye Bolunen Sayilarin Toplami = " + topla);
            Console.ReadLine();
        }
    }
}

Hiç yorum yok:

Yorum Gönder