0% found this document useful (0 votes)
29 views2 pages

Sol

The document contains two C programs. The first program calculates pairs of integers that sum to a given number and checks if the reverse of the first integer is divisible by the sum of the digits of the second integer. The second program processes student scores, calculating the pass percentage for a specific index group and the average score of students who passed.

Uploaded by

vasko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Sol

The document contains two C programs. The first program calculates pairs of integers that sum to a given number and checks if the reverse of the first integer is divisible by the sum of the digits of the second integer. The second program processes student scores, calculating the pass percentage for a specific index group and the average score of students who passed.

Uploaded by

vasko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

dsadas#include <stdio.

h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <ctype.h>

int main()
{
int n;
int temp_first = 0;
int temp_second = 0;

int sum;
int rev;
int pass = 1;

scanf("%d",&n);

for (int i =1;i<n;i++){


for(int j =1;j<n;j++){
sum = 0;
rev = 0;
pass = 1;
if (i+j != n){
pass = 0;
}
temp_first = i;
temp_second = j;
while (temp_first > 0){
rev*=10;
rev += temp_first%10;
temp_first/=10;
}

while(temp_second > 0){


sum+=temp_second%10;
temp_second/=10;
}

if(rev % sum == 0 && pass){


printf("%d %d\n",i,j);
}
}
}
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <ctype.h>

int main()
{
int len;
scanf("%d",&len);
float brucosi_len= 0;
int brucos_pass = 0;

float points_sum =0;


float polozile_len = 0;

int index =0; float points = 0;

for(int i =0;i<len;i++){
scanf("%d%f",&index,&points);
if (points >= 40 ){
points_sum+=points;
polozile_len++;
}

if (index/10000 == 21) {
brucosi_len++;
if (points >= 40.0){
brucos_pass++;
}
}

printf("%.2f\%%\n",(brucos_pass * 100.0) / brucosi_len);

printf("%.2f",points_sum/polozile_len);
}

You might also like