Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi A - F > Algoritmi e strutture dati > Esercizio quadrato magico
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
lem_123
.primate.

User info:
Registered: Jan 2013
Posts: 65 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 6:48:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Esercizio quadrato magico

Qualcuno di voi ha svolto l'esercizio 1.6 Quadrato magico?
Non riesco a risolverlo. Durante la lezione la professoressa ha dato qualche suggerimento?

Grazie

28-10-2016 20:54
Click Here to See the Profile for lem_123 Click here to Send lem_123 a Private Message Find more posts by lem_123 Add lem_123 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
lem_123
.primate.

User info:
Registered: Jan 2013
Posts: 65 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 6:48:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Re: Esercizio quadrato magico

Originally posted by lem_123
Qualcuno di voi ha svolto l'esercizio 1.6 Quadrato magico?
Non riesco a risolverlo. Durante la lezione la professoressa ha dato qualche suggerimento?

Grazie


nessuno?

31-10-2016 08:37
Click Here to See the Profile for lem_123 Click here to Send lem_123 a Private Message Find more posts by lem_123 Add lem_123 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
lem_123
.primate.

User info:
Registered: Jan 2013
Posts: 65 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 6:48:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ho finalmente risolto:
**************************************************
*******************************************
#include <stdio.h>
#define N 100
int main(void)
{
int quadrato[N][N]={{0}};
int r,rn,c,cn,i,n;

printf("Inserire il numero dispari per definire il quadrato:");
scanf("%d", &n);
c=n/2;
r=0;

for (i=1;i<=n*n;i++)
{
quadrato[r][c]=i;
rn=(r>0)?r-1:n-1;
cn=(c>=n-1)?0:c+1;
if(quadrato[rn][cn]==0)
{
r=rn;
c=cn;
}
else
r=r+1;
}
for (r=0;r<n;r++)
{
for (c=0;c<n;c++)
printf("%d\t", quadrato[r][c]);
printf("\n");
}


return 0;
}

31-10-2016 21:14
Click Here to See the Profile for lem_123 Click here to Send lem_123 a Private Message Find more posts by lem_123 Add lem_123 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 23:20.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.032 seconds (72.51% PHP - 27.49% MySQL) con 29 query.