Zgjidhja e Ushtrimeve te Leksionit 5

Një zgjidhje e ushtrimeve të leksionit 5 :

Ushtrimi 1 :

#include <stdio.h>
#include <conio.h>

int main() {
int x, i;
printf(“Fut nje numer: “);
scanf(“%d”, &x);
for(i=1; i<x; i++){
printf(“%d”, i*i*i);
printf(“\n”);
}
getch();
return 0;
}

___________________________________________

Ushtrimi 2 :
2)

#include<stdio.h>
#include<conio.h>
int main(){
int a,b,c;
printf(“Jepni nje numer te plote : “);
scanf(“%d”,&a);
printf(“Jepni nje numer te plote : “);
scanf(“%d”,&b);
printf(“Jepni nje numer te plote : “);
scanf(“%d”,&c);
if(a%5==0||b%5==0||c%5==0)printf(“\n\t\tPo!”);
else printf(“\n\t\tJo!”);
getch();
return 0;
}

3)

#include<stdio.h>
#include<conio.h>
int main(){
int a,b,c;
printf(“Jepni nje numer te plote : “);
scanf(“%d”,&a);
printf(“Jepni nje numer te plote : “);
scanf(“%d”,&b);
printf(“Jepni nje numer te plote : “);
scanf(“%d”,&c);
if(a>=b&&a>=c)printf(“\n\t\t%d”,a);
else if(b>=a&&b>=c)printf(“\n\t\t%d”,b);
else printf(“\n\t\t%d”,c);
getch();
return 0;
}

4)

#include<stdio.h>
#include<conio.h>
int main(){
int a,b,c,shuma;
printf(“Jepni nje numer te plote : “);
scanf(“%d”,&a);
printf(“Jepni nje numer te plote : “);
scanf(“%d”,&b);
printf(“Jepni nje numer te plote : “);
scanf(“%d”,&c);

if(a>=b&&a>=c){
shuma=b+c;
if(a>shuma)printf(“\nNumri %d eshte me i madh se shuma %d + %d .”,a,b,c);
else if(a==shuma)printf(“\nNumri %d eshte i barabarte me shumen %d + %d .”,a,b,c);
else printf(“\nShuma %d + %d eshte me e madhe se numri %d .”,b,c,a);
}
else if(b>=a&&b>=c){
shuma=a+c;
if(b>shuma)printf(“\nNumri %d eshte me i madh se shuma %d + %d .”,b,a,c);
else if(b==shuma)printf(“\nNumri %d eshte i barabarte me shumen %d + %d .”,b,a,c);
else printf(“\nShuma %d + %d eshte me e madhe se numri %d .”,a,c,b);
}
else {
shuma=a+b;
if(c>shuma)printf(“\nNumri %d eshte me i madh se shuma %d + %d .”,c,b,a);
else if(c==shuma)printf(“\nNumri %d eshte i barabarte me shumen %d + %d .”,c,b,a);
else printf(“\nShuma %d + %d eshte me e madhe se numri %d .”,b,a,c);
}
getch();
return 0;
}

___________________________________________

Ushtrimi 3 :

#include <stdio.h>
#include <conio.h>

int main() {
char c;
for(c=’a’; c<=’z’; c++){
printf(“%c \t”, c);
}
getch();
return 0;
}

___________________________________________

Ushtrimi 4 :

#include <stdio.h>
#include <conio.h>

int main() {
int x, i, j;
printf(“Fut numrin e rrjeshtave: “);
scanf(“%d”, &x);
for(i=1; i<=x; i++){
for(j=1; j<=i; j++){
printf(“*”);
}
printf(“\n”);
}
getch();
return 0;
}

_____________________________________________________

Ushtrimi 5 :

#include <stdio.h>
#include <conio.h>
int main() {
int x, i;
int shuma = 0;
printf(“Fut nje numer natyror: “);
scanf(“%d”, &x);
for(i=1; i<=x; i+=2){
shuma += i;
}
printf(“Shuma e %d numrave natyrore tek eshte %d \n”, x, shuma);
if((shuma>100) && (shuma%2==0)){
printf(“Shuma eshte numer cift me i madh se 100”);
}
if((shuma<100) || (shuma%2!=0)){
printf(“Shuma nuk eshte numer cift me i madh se 100”);
}
getch();
return 0;
}

___________________________________________

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: