| | |
Pascal Triangle program that needs to convert from C to C#
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2008
Posts: 6
Reputation:
Solved Threads: 0
Hi All,
I have this old c program that I did a while back on pascals triangle and i'm trying to convert it over to c#.net. Can anyone help me do this? I do not know much or anything on on c#
Here is the code:
I have this old c program that I did a while back on pascals triangle and i'm trying to convert it over to c#.net. Can anyone help me do this? I do not know much or anything on on c#
Here is the code:
c Syntax (Toggle Plain Text)
//Lyncob directory #include <stdio.h> #include <stdlib.h> int main() { int numberOfLevels, i, j , k, spaces = 5; printf ( "How many rows you want to show?: "); scanf ( "%d", & numberOfLevels); for ( i = 0; i < numberOfLevels; i ++ ) { int currentElement = 1; k = 0; while ( k < spaces ) { printf ( " " ); k ++; } for ( j = i; j >= 0; j -- ) { printf ( " %d", currentElement ); currentElement = currentElement * j / ( i - j + 1 ); } printf("\n"); spaces --; } }
Last edited by Narue; Oct 15th, 2008 at 3:17 pm. Reason: added code tags
![]() |
Similar Threads
- Need Help With Some Programs (C)
- Pyramid...questioN?? (C)
- Pascal Triangle (C++)
Other Threads in the C Forum
- Previous Thread: Help searching for a keyword in a file.....
- Next Thread: simple calculator using a scanner (re2c) and a parser generator (lemon)
| Thread Tools | Search this Thread |
Tag cloud for C
* adobe api append array arrays bash binarysearch changingto char character cm copyanyfile copypdffile createcopyoffile createprocess() csyntax directory dynamic execv feet fgets file floatingpointvalidation fork frequency function getlogicaldrivestrin givemetehcodez global gtkgcurlcompiling gtkwinlinux highest histogram homework i/o ide include infiniteloop initialization input interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list lowest matrix meter microsoft mqqueue multi mysql oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scheduling segmentationfault send single socketprogramming spoonfeeding stack standard strchr string suggestions system test testautomation unix urboc user whythiscodecausesegmentationfault win32api windows.h windowsapi





