Zgjidhja e Ushtrimeve te Leksionit 12 (I fundit)

Një zgjidhje e ushtrimeve të leksionit 12 :

Ushtrimi 1:

#include<stdio.h>
#include<conio.h>
int main() {
int v[5],i;
int *p=v;
printf(“Fut pese numra : “);
scanf(“%d%d%d%d%d”,p,p+1,p+2,p+3,p+4);
printf(“Numrat e futur jane : \n”);
for(i=4;i>=0;i–)
printf(” %d “,*(p+i));
getch();
return 0;
}
____________________________________

Ushtrimi 2:
#include<stdio.h>
#include<conio.h>
void dyfishim(int *num){
*num*=2;
}
int main(){
int a;
printf(“Jep numrin : “);
scanf(“%d”,&a);
dyfishim(&a);
printf(“\nNumri i dyfishuar eshte %d.”,a);
getch();
return 0;
}
____________________________________

Ushtrimi 3 :

#include<stdio.h>
#include<conio.h>
main(){
struct liber{
char emri[25];
char autori[25];
int faqe;
};
struct liber b1 = { “Keshtjella”, “Ismail Kadare”, 200 };
struct liber *shenjues;
shenjues = &b1;
printf(“%s %s %d \n”, shenjues->emri, shenjues->autori, shenjues->faqe);
getch();
return 0;
}
____________________________________

Ushtrimi 4 :

#include<conio.h>
#include<stdio.h>
const int n=5,m=5;
void njehsimtabele(int t[n][m]){
for(int i=0;i<n;i++)
for(int j=0;j<m;j++){
printf(“Jep elementin e %d te rreshtit te %d te tabeles : “,j+1,i+1);
scanf(“%d”,&t[i][j]);
}
}
void funksion(int a[n][m],int *rr,int *sh,int *min){
*min=9999;
int pozi,pozj,i,j;
for(i=0;i<n;i++)
for(j=0;j<m;j++)
if(a[i][j]<*min){
*min=a[i][j];
pozi=i;
pozj=j;
}
printf(“\nElementi me i vogel eshte %d.”,*min);
printf(“\nKy element gjendet ne tabele ne pozicionin a[%d][%d].\n”,pozi,pozj);
}
int main(){
int a[n][m];
int rr,sh,min;
njehsimtabele(a);
funksion(a,&rr,&sh,&min);
getch();
return 0;
}

____________________________________

Studime të mbara!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: