Snippets Collections
# Python 3 code for Pascal's Triangle 
# A simple O(n^3)  
# program for  
# Pascal's Triangle 
  
# Function to print  
# first n lines of 
# Pascal's Triangle 
def printPascal(n) : 
      
    # Iterate through every line  
    # and print entries in it 
    for line in range(0, n) : 
          
        # Every line has number of  
        # integers equal to line 
        # number 
        for i in range(0, line + 1) : 
            print(binomialCoeff(line, i), 
                " ", end = "") 
        print() 
      
  
# See https://www.geeksforgeeks.org/space-and-time-efficient-binomial-coefficient/ 
# for details of this function 
def binomialCoeff(n, k) : 
    res = 1
    if (k > n - k) : 
        k = n - k 
    for i in range(0 , k) : 
        res = res * (n - i) 
        res = res // (i + 1) 
      
    return res 
  
# Driver program 
n = 7
printPascal(n) 
  
  
# This code is contributed by Nikita Tiwari.
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    title: 'Flutter Tutorial',
    home: MyApp(),
    debugShowCheckedModeBanner: false,
  ));
}

class MyApp extends StatefulWidget {
  @override
  _State createState() => _State();
}

class _State extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color(0xff885566),
        title: Text(
          'Flutter Tutorial - googleflutter.com',
        ),
      ),
      body: Container(),
    );
  }
}
star

Mon Jul 11 2022 17:02:02 GMT+0000 (Coordinated Universal Time) https://blog.faradars.org/program-to-find-pascal-triangle/

#clike
star

Mon Apr 11 2022 16:26:01 GMT+0000 (Coordinated Universal Time) https://googleflutter.com/flutter-app-bar-color/

#clike

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension