• 19-10-2015, 16:11:10
    #1
    1- Write a program that takes a number n (between 1 and 999) from the user and finds “how many times the digits 4 and 9 occurs from 1 to n”.

    Example :
    Input: 100
    Output: 40


    (because 4 9 14 19 24 29 34 39 49 41 42 43 44 45 46 47 48 49 54 59 64 69 74 79 84 89 90 91 92 93 94 95 96 97 98 99)



    2- Write a C# program that takes a number from the user and prints one of the followings:
    - pentagonal and heptagonal
    - Not pentagonal but heptagonal
    - Pentagonal but not heptagonal
    - Neither pentagonal nor heptagonal

    A pentagonal number is a number of the form Pn = n(3n−1)/2.
    The first few are 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, 532, 590, 651, 715, 782, 852, 925, 1001... etc.

    A heptagonal number is a number of the form Hn = n(5n-3)/2.
    The first few are 1, 7, 18, 34, 55, 81, 112, 148, 189, 235, 286, 342, 403, 469, 540, 616, 697, 783, 874, 970, 1071... etc.

    Examples:
    Input: 4347
    Output: pentagonal and heptagonal

    Input: 590
    Output: Pentagonal but not heptagonal


    bu iki soruyu c# da kodlarına ıhtıyacım var yalnız for , if , while ve switch dongulerı goruldu bunlar kullanılarak yapılmalı yardım edebilecek olursa cok buyuk yardımı dokunur sımdıden tesekkur edıyorum
  • 19-10-2015, 16:31:30
    #2
    İlk olarak int türünde bir n tanımlamalıyız

    int n;
    
    Console.Write("Bir sayı giriniz:");
    n=int.Parse(Console.ReadLine()):
    şeklinde giriş işlemini yapmalıyız.

    if (n(3n−1)/2) Console.Write("abcd");
    gibi bir if işlemi ile bunu halledebilirsiniz. Pek bilgim yok fakat bu yoldan gidebilirsiniz.
  • 19-10-2015, 19:58:02
    #3
    cok tesekkurler fakat ben c# dair hiçbirşey bilmıyorum yanı bana dırek onun cevabı gerekıyor dili bilen arkadaslar icin cok zor olmadıgı dusuncesındeyım
  • 19-10-2015, 20:07:53
    #4
    adam yardım aramıyo son ütücü mübarek acil acil nedir bu nasıl bir ülke arkadaş. Bence sen kayıt ol biz gidelim okuluna.
  • 19-10-2015, 21:39:08
    #5
    VoyL adlı üyeden alıntı: mesajı görüntüle
    adam yardım aramıyo son ütücü mübarek acil acil nedir bu nasıl bir ülke arkadaş. Bence sen kayıt ol biz gidelim okuluna.
    sana bana program kodla beleşe ver mi dedik arkadasım ne zırvalıyon sen
    ınsan gıbı 2 tane sorunun cozumunu ıstedık acilse de acil yazarım hadi yazmamı engelle bakım kımsın sen yaylan konumdan