Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////прва --
- #include <stdio.h>
- void pomal(int n1, int n2);
- float a[100];
- int i, n;
- void pomal(int n1, int n2){
- float t;
- if (a[n1]<a[n2]){t=a[n1];a[n1]=a[n2];a[n2]=t;}
- if((n1>0)&&(a[n1-1]<a[n1])){pomal(n1-1, n1);}
- }
- int main (){
- scanf("%d", &n);
- for(i=0; i<n;i++){
- scanf("%f", &a[i]);
- }
- for(i=0;i<n-1;i++){
- pomal(i,i+1);
- }
- for(i=0; i<n;i++){
- printf("%.2f\t", a[i]);
- }
- return 0;
- }
- //////////////////////////////втора --
- #include <stdio.h>
- int nzd(int a, int b){
- int i;
- for (i=a;i>0;i--){
- if(a%i==0 && b%i==0){return i;}
- }
- }
- int main(){
- int n, m, nz;
- scanf("%d %d", &n, &m);
- nz = nzd(n, m);
- printf("%d / %d", n/nz, m/nz);
- return 0;
- }
- //////////////////////////////трета --
- #include <stdio.h>
- float zbir(int a){
- int i;
- float zbi=0;
- for (i=1;i<=a;i++){
- if (a%i==0){zbi+=i;}
- }
- return zbi;
- }
- int main(){
- int i, i2,n, m;
- scanf("%d %d", &n, &m);
- for(i=n; i<=m; i++){
- for(i2=i; i2<=m; i2++){
- if(((zbir(i)*1.0/i) == (zbir(i2)*1.0/i2)) && i2!=i)
- {
- printf("Prijatelski se: (%d, %d)\n", i, i2);
- }
- }
- }
- return 0;
- }
- //////////////////////////////четврта --
- #include <stdio.h>
- int n, broj=0, prv=0;
- int prost(int a)
- {
- int i, brojac=0;
- for (i=1;i<=a;i++){
- if(a%i==0){brojac++;}
- }
- if (brojac==2){return 1;}
- else {
- return 0;}
- }
- void deliteli(int r){
- if(n%r == 0){
- broj++;
- n/=r;
- deliteli(r);
- }
- if(broj){
- if(prv){printf("*%d^%d", r, broj);}
- else{printf("%d^%d", r, broj);prv++;}
- broj=0;}
- }
- int main(){
- int i;
- scanf("%d", &n);
- printf("%d=", n);
- for (i=2;i<=n;i++)
- {
- if(prost(i)){
- deliteli(i);
- }
- }
- return 0;
- }
- //////////////////////////////петта --
- #include<stdio.h>
- #include<stdlib.h>
- long maafaka(int n)
- {
- int c;
- long rez=1;
- for(c=1; c<=n; c++)
- rez=rez*c;
- return (rez);
- }
- int main()
- {
- int i, n, c;
- printf("Vnesete go brojot na redovi vo paskaloviot triagolnik: \n");
- scanf("%d",&n);
- system("cls");
- for (i=0; i<n; i++)
- {
- for (c=0; c<=(n-i-2); c++)
- printf(" ");
- for(c=0; c<=i ;c++)
- printf("%1d ",maafaka(i)/(maafaka(c)*maafaka(i-c)));
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement