| | |
Print table of a number entered by user
![]() |
•
•
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; 26 Days Ago 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: 47
Reputation:
Solved Threads: 2
0
#3 26 Days Ago
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
| Thread Tools | Search this Thread |
#include * ansi array arrays asterisks bash binarysearch calculate centimeter changingto char character convert copyanyfile copyimagefile copypdffile creafecopyofanytypeoffileinc createprocess() database dynamic execv fflush fgets file floatingpointvalidation fork forloop function getlogicaldrivestrin givemetehcodez grade gtkwinlinux histogram homework i/o ide inches include infiniteloop initialization input interest intmain() iso keyboard km license linked linkedlist linux list looping lowest matrix meter microsoft mysql number oddnumber open opendocumentformat openwebfoundation pdf pointer pointers posix power process program programming pyramidusingturboccodes radix read recursion recv recvblocked reversing scheduling segmentationfault send sequential single socket socketprogramming stack standard strchr string suggestions test threads turboc unix urboc user variable whythiscodecausesegmentationfault win32api windowsapi





