int my_strlen(char* str) {
int i = 0;
while (str[i] != '\0') {
i++;
}
return i;
}
char* my_strcat(char* str1, char* str2) {
int len1 = my_strlen(str1);
int len2 = my_strlen(str2);
char* str3 = (char*)malloc((len1 + len2 + 1) * sizeof(char));
if (!str3) {
printf("内存分配失败!\n");
return NULL;
}
for (int i = 0; i < len1; i++) {
str3[i] = str1[i];
}
for (int i = 0; i < len2; i++) {
str3[len1 + i] = str2[i];
}
str3[len1 + len2] = '\0';
return str3;
}
void my_strcpy(char* str1, char* str2) {
int len = my_strlen(str2);
for (int i = 0; i < len; i++) {
str1[i] = str2[i];
}
str1[len] = '\0';
}
int my_strcmp(char* str1, char* str2) {
int len1 = my_strlen(str1);
int len2 = my_strlen(str2);
if (len1 != len2) {
return len1 - len2;
}
for (int i = 0; i < len1; i++) {
if (str1[i] != str2[i]) {
return str1[i] - str2[i];
}
}
return 0;
}
#include<stdio.h>
int fiobo(int n)
{
if(n==0)
return 1;
else if(n==1)
return 1;
}
int main()
{
int a;
scanf("%d", &a);
}
#include <stdio.h>
#define MAX_ROWS 99
int main() {
unsigned int c[MAX_ROWS][MAX_ROWS];
int n;
printf("Enter the number of rows for Pascal's triangle: ");
scanf("%d", &n);
for (int i = 0; i < n; i++) {
for (int space = 1; space <= n - i; space++) {
printf(" ");
}
for (int j = 0; j <= i; j++) {
if (j == 0 || j == i)
c[i][j] = 1;
else
c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
printf("%4d ", c[i][j]);
}
printf("\n");
}
return 0;
}