www.fatihkabakci.com

Personal Website and Computer Science TUR EN

MATRIS DE BOLGE

Last update: 2/22/2012 5:20:00 AM

Yazan ve Cevaplayan:Fatih KABAKCI

Bu soru Chip Online sayfasında 30.12.2010 tarihinde Matella adlı kullanıcı tarafından sorulmuştur.

Gelen Soru: 2.Dışarıdan girilen bir matrisin üst bölgesinde kalan elemanlardan pozitif ve çift olanların sayısını bulun.

Verilen Cevap:

2. Matrisin 'Üst' bölgesi diye adlandırılan soruda,matrisin asal köşegenlerinin üst bölmesinde bulunan elemanları sorulmaktadır.Yine 3-3 bir matris uzerinde sorumuzu orneklendirelim.
M11 M12 M13
M21 M22 M23
M31 M32 M33
Şeklindeki bir matris ele aldıgımızda,asal köşegenlerin M11,M22 ve M33 oldugunu hatırlanacaktır.Dolayısıyla bu köşegen üzerinde kalan elamanlar M12,M13 ve M23 olacaktır.Soruda ise,bu degerlerin pozitif ve cift olması istenmektedir.Bir sayı 0'dan buyuk oldugu takdirde pozitif olarak adlandırılırken,sayı 2'ye kalansız bolunurse aynı zamanda cift bir sayı olma ozelligi kazanmaktadır.O halde yukarıdaki algoritmanın C dilindeki karsılıgı asagıdaki gibi olabilir.
#include <stdio.h>
#define boy 3
int main()  {
 
    int matrix[boy][boy]={
                          {1,2,3},
                          {2,4,4},
                          {6,7,8}
                          };
                          
    int i,j,count=0;
    for(i=0;i<boy;i++)
    for(j=i+1;j<boy;j++)
    if(matrix[j] > 0 && matrix[j]%2==0) 
    count++;
    printf("Toplam Sayi:%d",count);
    getchar();
    return 0;
    }
Yukarıda beklenen cıktı 2 olacaktır.(M[0][1]=2 ve M[1][2]=4 degerleri icin).
Başarılar
There has been no comment yet

Name:


Question/Comment
   Please verify the image




The Topics in Computer Science

Search this site for





 

Software & Algorithms

icon

In mathematics and computer science, an algorithm is a step-by-step procedure for calculations. Algorithms are used for calculation, data processing, and automated reasoning.

Programming Languages

icon

A programming language is a formal constructed language designed to communicate instructions to a machine, particularly a computer. It can be used to create programs to control the behavior of a machine. Java,C, C++,C#

Database

icon

A database is an organized collection of data. The data are typically organized to model aspects of reality in a way that supports processes requiring information.

Hardware

icon

Computer hardware is the collection of physical elements that constitutes a computer system. Computer hardware refers to the physical parts or components of a computer such as the monitor, memory, cpu.

Web Technologies

icon

Web development is a broad term for the work involved in developing a web site for the Internet or an intranet. Html,Css,JavaScript,ASP.Net,PHP are one of the most popular technologies. J2EE,Servlet, JSP,JSF, ASP

Mobile Technologies

icon

Mobile application development is the process by which application software is developed for low-power handheld devices, such as personal digital assistants, enterprise digital assistants or mobile phones. J2ME

Network

icon

A computer network or data network is a telecommunications network that allows computers to exchange data. In computer networks, networked computing devices pass data to each other along data connections.

Operating Systems

icon

An operating system is software that manages computer hardware and software resources and provides common services for computer programs. The OS is an essential component of the system software in a computer system. Linux,Windows

Computer Science

icon

Computer science is the scientific and practical approach to computation and its applications.A computer scientist specializes in the theory of computation and the design of computational systems.