O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

hello- i have been trying to write this following forgram in c for the.docx

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
C Programming Example
C Programming Example
Carregando em…3
×

Confira estes a seguir

1 de 2 Anúncio

hello- i have been trying to write this following forgram in c for the.docx

Baixar para ler offline

hello, i have been trying to write this following forgram in c for the past couple of days but i can not get my head around it. the program can only be written in C with C standard libraries. your help will be much appreciated.
Please take the array {
Solution
#include <stdio.h>
#include <stdlib.h>
void duplicate(int a[], int n)
{
int i, j, count=0;
for(i = 0; i < n; i++)
for(j = i+1; j < n; j++)
if(a[i] == a[j])
{
printf(\" \ Value \");
printf(\" %d \", a[i]);
printf(\" was found at indices: %d, %d \", i,j);
count++;
}
printf(\" \ Total dublicate found:%d \", count);
}
int main()
{
int a[]={47,48,58,123,456,789,188,0,3000,47,939,2373,1873,283,948,333,283,2835,248,444,555,732,1983,473,939,3000,7,9,2496,1729,1776,11,12,84,126,120,-1};
int n;
n=sizeof(a)/sizeof(a[0]);
duplicate(a,n);
return 0;
}
.

hello, i have been trying to write this following forgram in c for the past couple of days but i can not get my head around it. the program can only be written in C with C standard libraries. your help will be much appreciated.
Please take the array {
Solution
#include <stdio.h>
#include <stdlib.h>
void duplicate(int a[], int n)
{
int i, j, count=0;
for(i = 0; i < n; i++)
for(j = i+1; j < n; j++)
if(a[i] == a[j])
{
printf(\" \ Value \");
printf(\" %d \", a[i]);
printf(\" was found at indices: %d, %d \", i,j);
count++;
}
printf(\" \ Total dublicate found:%d \", count);
}
int main()
{
int a[]={47,48,58,123,456,789,188,0,3000,47,939,2373,1873,283,948,333,283,2835,248,444,555,732,1983,473,939,3000,7,9,2496,1729,1776,11,12,84,126,120,-1};
int n;
n=sizeof(a)/sizeof(a[0]);
duplicate(a,n);
return 0;
}
.

Anúncio
Anúncio

Mais Conteúdo rRelacionado

Semelhante a hello- i have been trying to write this following forgram in c for the.docx (20)

Mais de rtodd588 (20)

Anúncio

Mais recentes (20)

hello- i have been trying to write this following forgram in c for the.docx

  1. 1. hello, i have been trying to write this following forgram in c for the past couple of days but i can not get my head around it. the program can only be written in C with C standard libraries. your help will be much appreciated. Please take the array { Solution #include <stdio.h> #include <stdlib.h> void duplicate(int a[], int n) { int i, j, count=0; for(i = 0; i < n; i++) for(j = i+1; j < n; j++) if(a[i] == a[j]) { printf(" Value "); printf(" %d ", a[i]); printf(" was found at indices: %d, %d ", i,j); count++; } printf(" Total dublicate found:%d ", count); } int main() { int a[]={47,48,58,123,456,789,188,0,3000,47,939,2373,1873,283,948,333,283,2835,248,444,555,73 2,1983,473,939,3000,7,9,2496,1729,1776,11,12,84,126,120,-1}; int n; n=sizeof(a)/sizeof(a[0]); duplicate(a,n);
  2. 2. return 0; }

×