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
c# odevıne yardımcı olacaklar acildir
4
●529
- 19-10-2015, 16:31:30İ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, 21:39:08sana bana program kodla beleşe ver mi dedik arkadasım ne zırvalıyon senVoyL adlı üyeden alıntı: mesajı görüntüle
ı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