C
1
Name:
t work
2010-11-13 11:19
What's wrong with this shit? It's supposed to multiply every line seperatly for example we have the array
123
456
789
it's supposed to do this: 1*2*3=6 ; 4*5*6=120; 7*8*9=504;
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int mas1[2][3]={{1,2,3},{4,5,6},{7,8,9}};
int mas[100];
int i,j,m,n,k;
j=0;
i=0;
m=2;
n=3;
for(k=0;k<=m;k++)
{
mas[k]= mas1[i] [j] * mas1[i] [j+1] * mas1[i] [j+2];
i++;
printf("%d",mas[k],",\t");
}
system("PAUSE");
return 0;
}
2
Name:
Anonymous
2010-11-13 11:24
Use code tags.
3
Name:
Anonymous
2010-11-13 11:26
Try:
mas[k]= mas1[j][i] * mas1[j+1][i] * mas1[j+2][i] ;
4
Name:
Anonymous
2010-11-13 11:27
system("PAUSE");
and you dare to say "what's wrong with this shit"?
Also, say [*] .comb for lines
5
Name:
Anonymous
2010-11-13 11:28
Also:
int mas1[3][3]={{1,2,3},{4,5,6},{7,8,9}};
Not [2][3]
6
Name:
mfw
2010-11-13 11:58
system("PAUSE");
q (〇_〇)p
7
Name:
Anonymous
2010-11-13 11:59
hackish C style:
int a=0, i;
for(i=0;i<strlen(buf);i++) {
if(buf[i] == 10) {
printf("%d\n", a);
a=0;
} else if(buf[i] > 48) {
a *= buf[i] -48;
}
}
if(a > 0) printf("%d\n", a);
8
Name:
Anonymous
2010-11-13 12:06
>>7
Learn to '0', and '\n', and '\r'.
9
Name:
Anonymous
2010-11-13 12:25
10
Name:
Anonymous
2010-11-13 13:57
still not working
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int mas1[3][3]={{1,2,3},{4,5,6},{7,8,9}};
int mas[100];
int i,j,m,k;
j=0;
i=0;
m=3;
for(k=0;k<=m;k++)
{
mas[k]= mas1[i] [j] * mas1[i] [j+1] * mas1[i] [j+2];
i++;
printf("%d",mas[k],"\n");
}
return 0;
}
11
Name:
Anonymous
2010-11-13 14:44
>>9
Chill out, it's just Perl 6
12
Name:
Anonymous
2010-11-14 11:19
oh wait, it was all good, the printf was wrong
printf("%d\n",mas[k]);
and it's good
13
Name:
Anonymous
2010-11-14 11:48
#include <stdio.h>
int main (int argc, char *argv[])
{
auto int mas1[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
auto int mas[100] = {0};
auto int i = 0, j = 0, m = 3;
while (i < m) {
mas[i] = mas1[i][j]*mas1[i][j+1]*mas1[i][j+2];
printf("%i \n",mas[i]);
++i;
}
return 0;
}
:(
14
Name:
Anonymous
2010-11-14 12:00
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{
int **mas1;
int *mas;
int *i,*j,*m;
i = calloc(1,sizeof(int));
j = calloc(1,sizeof(int));
m = calloc(1,sizeof(int));
m[0]= 3;
mas = calloc(100,sizeof(int));
mas1= calloc(3,sizeof(int *));
for(i[0]=0;i[0]<m[0];++i[0]){
mas1[i[0]] = calloc(3,sizeof(int));
mas1[i[0]][0] = j[0];
mas1[i[0]][1] = j[0]+1;
mas2[i[0]][2] = j[0]+2;
j[0]=j[0]+3;
}
free(j);
while (i[0] < m[0]) {
mas[i[0]] = mas1[i[0]][0]*mas1[i[0]][1]*mas1[i[0]][2];
printf("%i \n",mas[i[0]]);
++i;
}
for(i[0]=0;i[0]<m[0];++i[0])
free(mas1[i[0]]);
free(mas1);
free(mas);
free(i);
free(m);
return 0;
}
15
Name:
Anonymous
2010-11-14 16:01
>>8
Posting a correct program would be
helping him .
16
Name:
Anonymous
2010-11-14 19:30
And we usually DON'T HELP HIM!!
17
Name:
Anonymous
2010-11-15 3:05
>>15
>>16
what if it's a she?
18
Name:
Anonymous
2010-11-15 3:45
>>17
There are no women on the internet.
19
Name:
Anonymous
2010-11-15 10:55
>>17
I know a few women. They have better sense than to visit /prog/. It's easy to extrapolate that none would come here, or at least if they did, they would ask better questions.
20
Name:
Anonymous
2010-11-15 16:50
>>19
I know a few women.
Megaaaaaaaaan....
21
Name:
Anonymous
2010-11-16 0:41
I'm going to rape you in the butthole if you ever use system("PAUSE") again.
22
Name:
Anonymous
2010-11-16 3:06
>>21
whyyyyyyyyyyyyyyyyyyy
23
Name:
Anonymous
2010-11-16 6:07
>>21 ahh... the romance...
24
Name:
Anonymous
2010-11-16 6:10
>>21
the timeless art of seduction
25
Name:
Anonymous
2010-11-17 16:22
nerds LOL
26
Name:
Anonymous
2010-11-17 16:30
>>25
Fuck off, ``faggot''.
27
Name:
Anonymous
2010-11-17 16:44
>>21
THE PLEASURE OF BEING CUMMED INSIDE
29
Name:
Anonymous
2010-12-25 7:40
30
Name:
Anonymous
2013-09-09 3:28
>>1
USE THE
[code] TAGS!!!
Newer Posts