觉得写的不错记得点个赞
c语言
#include <stdio.h>
int main ()
{
for(int x=1;x<=9;x++){
for(int y=1;y<=x;y++){
printf("%d*%d=%2d\t",x,y,x*y);
}
printf("\n");
}
}
运行结果
js
function a99(a){
for(var i=1;i<=a;i++){
for(var j=1;j<=i;j++){
document.write(j+"x"+i+"="+j*i+" ");
}
// document.writeln("asd");
document.write("<br>");
}
}
a99(9);
运行结果
java
package chengf;
public class 九九乘法表 {
/**
* @param args
*/
public static void main(String[] args) {
for(int i=1;i<10;i++){
for(int j=1;j<=i;j++){
System.out.print(i+"*"+j+" ="+j*i+" ");
}
System.out.print("\n");
}
}
运行结果
OC
//
// main.m
// 99乘法表
//
// Created by 筱欣 on 2020/9/12.
// Copyright © 2020 筱欣. All rights reserved.
//
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSString *str=@"";
for(int i=1;i<10;i++){
for(int j=1;j<=i;j++){
str=[NSString stringWithFormat:@"%@ %d*%d=%2d",str,i,j,i*j];
}
NSLog(@"%@",str);
str=@"";
}
}
return 0;
}
运行结果