| | |
Print table of a number entered by user
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2009
Posts: 28
Reputation:
Solved Threads: 0
Hi,
I would like to print the table of a number entered by the user like
2 *1=2
2*2=4
2*3=6
The code is
But this code is generating errors.
I would like to print the table of a number entered by the user like
2 *1=2
2*2=4
2*3=6
The code is
c Syntax (Toggle Plain Text)
#include<stdio.h> #include<conio.h> main() { int i,num; printf("Enter any number"); scanf("%d",&num); for(i=1;i<=num;i++) printf("%d*%d=%d",num,i,num*i); getch(); }
But this code is generating errors.
Last edited by peter_budo; Nov 4th, 2009 at 5:09 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
•
•
Join Date: Oct 2009
Posts: 67
Reputation:
Solved Threads: 3
0
#3 Nov 3rd, 2009
The code is perfect and no errors execpt few things that shuold be avoided.
may be you want to print from
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
:
:
5 * 10 = 50
here is your code with slight modifications and proper posting:
follow this next time
may be you want to print from
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
:
:
5 * 10 = 50
here is your code with slight modifications and proper posting:
follow this next time
C Syntax (Toggle Plain Text)
#include<stdio.h> int main() { int i, num; printf( " Enter any number " ); scanf( "%d", &num ); for( i=1 ;i <=10; i++ ) printf( " \t %d * %d = %d \n ", num, i, num*i ) ; return 0; }
![]() |
Similar Threads
- adding from 0 to a number that will be entered by the user . (C)
- How to sum cubes and squares of the number input by the user (C++)
- counting number of letters in the strings entered by the user (C++)
- For loop (C++)
- Intro to Java help (Java)
- Cant figure out second half of piramid (Java)
- Trying To Find The Square Root Of Each Number Of A Array (C++)
- Mortgage Program help (Java)
Other Threads in the C Forum
- Previous Thread: 32 bits/64 bits case
- Next Thread: read e-mail attachment with POP3
Views: 307 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C
#include ansi array arrays asterisks binarysearch calculate centimeter changingto char command convert copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic fflush file fork forloop framework functions getlasterror givemetehcodez grade graphics hacking hardware histogram homework inches include incrementoperators input iso kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives looping loopinsideloop. lowest match matrix microsoft motherboard multi mysql number opendocumentformat opensource owf pattern pdf performance pointer pointers posix problem probleminc process program programming radix recursion recv research reversing scanf scripting segmentationfault sequential shape socket socketprograming spoonfeeding standard string strings structures student systemcall testing threads turboc unix user variable voidmain() wab windowsapi





