This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <locale.h> | |
int main() { | |
setlocale(LC_ALL,"Russian"); | |
int age; | |
char *s = malloc(5); | |
scanf("%d", &age); | |
if (age%10==0||((age%10>=5) && (age%10<=9))||age/10==1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please enter an integer to be summed (q to quit): 39 | |
Please enter next integer (q to quit): 13 | |
Please enter next integer (q to quit): 88 | |
Please enter next integer (q to quit): q | |
________________________________________ | |
Those integers sum to 140. | |
Program ended with exit code: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
printf("Let's see if your number is divisible by 6.\nEnter a number: "); | |
int num; | |
scanf("%d",&num); | |
switch (num%3) { | |
case 0 : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enter a number of glasses of water: 3 | |
The number of water drops in 3 glass.es is 14970 | |
The number of water molecules is 2.495e+25 | |
Program ended with exit code: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enter the number of seconds elapsed today: 65434 | |
The time is 18:10:34 | |
Program ended with exit code: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a random integer generator. | |
Enter number range (e.g., 1-25): 50-66 | |
61 | |
Program ended with exit code: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
int main() { | |
double s1, s2, s3, p, area; | |
printf("Enter the lengths of 3 sides of a triangle: "); | |
scanf("%lf %lf %lf", &s1, &s2, &s3); | |
p = (s1 + s2 + s3) / 2; | |
area = sqrt(p*(p-s1)*(p-s2)*(p-s3)); | |
printf("The area of the triangle is %.2lf\n", area); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
int main() { | |
double s1, s2, angle, area; | |
printf("Enter the lengths of two sides of a triangle: "); | |
scanf("%lf %lf", &s1, &s2); | |
printf("Enter the angle between them (in degrees): "); | |
scanf("%lf", &angle); | |
area = (s1 * s2 * sin((3.141593 / 180) * angle)) / 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
int main() { | |
double x1, x2, y1, y2, dist; | |
printf("Enter the coordinates of a point A (x1 and y1): "); | |
scanf("%lf %lf", &x1, &y1); | |
printf("Enter the coordinates of a point B (x2 and y2): "); | |
scanf("%lf %lf", &x2, &y2); | |
dist = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
int main() { | |
double x, result; | |
printf("Введите число: "); | |
scanf("%lf", &x); | |
result = fabs(x); | |
printf("Модуль вашего числа = %.1lf\n", result); | |
return 0; |
NewerOlder