11 Temmuz 2011 Pazartesi

C# Girilen Sayının Negatif mi -- Pozitif mi olduğunu bulan Program

static void Main(string[] args)
 {
 Console.WriteLine(“girilen sayının negatif veya pozitif olduğunu bulan”);
int x = Convert.ToInt32(Console.ReadLine());
if (x >= 0)
 {
 Console.WriteLine(“girilen sayı pozitiftir”);
 }
else
 {
 Console.WriteLine(“girilen sayı negatif”);
 }
 Console.ReadLine();
 }
 }
 }

girilen x değerini 5 kere ekrana yazdırma

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace x_değerini_5_kere_yazdır
 {
class Program
 {
static void Main(string[] args)
 {
 Console.WriteLine(“x değerini 5 kez ekrana yazdır”);
int sayi = Convert.ToInt32(Console.ReadLine());
for (int index = 0; index < 5; index++)
 {
 Console.WriteLine(sayi);
 }
 Console.ReadLine();
 }
 }
 }

0 yorum:

Yorum Gönder