Viết hàm đếm tần suất xuất hiện của các giá trị xuất hiện trong mảng void lietke(int a[],int n){ int dem = 0; for(int i = 0 ; i < n ; i++){ dem = 0; for(int j = 0 ; j < n ; j++){ if(a[i] == a[j]){ if(i <= j){ dem ++ ; } else{ break; } } } if(dem != 0){ printf("%d : %d ",a[i],dem); } } } Tag: C, C++, mảng 1 chiều, mảng một chiều, array, one dimension array
Related Post:
Code C#: Code Examples sample source codesGet selected checkbox list itemsusing System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.CheckedListBox chkListPossibleValues; private System.Windows.Forms.ListBox lstSelected; priv…Read More
Code C#: Code Examples sample source codesCenter form window using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; public class Form1 : System.Windows.Forms.Form { private Button myButton; public Form1() { this.AutoSc…Read More
Code C#: Giải phương trình bậc nhất (Console)using System; namespace PhuongTrinhBacNhat{ class Program { static void Main(string[] args) { Console.Write("Nhap he so a :"); int a = int.Parse(Console.ReadLine()); Console.Write("Nhap h…Read More
Code C#: Giải phương trình bậc 2 (Console)/* Giải và biện luận phương trình bậc 2 (sử dụng ứng dụng Console) */using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace GiaiPT_bac2{ class Program{ static void Main(string[] args){ float a, b, c; string xau;…Read More
Code C#: Nhập, xuất với mảng 1 chiều (Console)using System;static void Main(string[] args){ int[] a = new int[10]; //nhap gia tri cho mang 1 chieu for (int i = 0; i < 10; i++){ Console.Write("Nhap a[{0}]=", i); a[i] = int.Parse(Console.ReadLine()); } //xuat mang 1 chieu for (int i…Read More
Klik untuk melihat kode: :) =( :s :D :-D ^:D ^o^ 7:( :Q :p T_T @@, :-a :W *fck* x@
Klik untuk melihat kode: :) =( :s :D :-D ^:D ^o^ 7:( :Q :p T_T @@, :-a :W *fck* x@