How we print the table of 2 using for loop in c
programing?
Answers were Sorted based on User's Feedback
Answer / anil kumar nahak
#include<stdio.h>
#include<conio.h>
void main()
{
int num=2,r;
clrscr();
printf("\n The Table Of Number Two \n");
for(r=1;r<=10;r++)
{
printf("\n %d * %d = %d",num,r,num*r);
}
getch();
}
| Is This Answer Correct ? | 333 Yes | 93 No |
Answer / shruthi
int i,result;
for(i=1;i<=10;i++)
{
result=i*2;
printf("%d\n",result);
}
| Is This Answer Correct ? | 174 Yes | 58 No |
Answer / hemendra singh gurjar
#include<stdio.h>
#include<conio.h>
void main()
{
int r;
clrscr();
printf("\n The Table Of Number Two \n");
for(r=1;r<=10;r++)
{
printf("\n%d",r*2);
}
getch();
}
| Is This Answer Correct ? | 79 Yes | 23 No |
Answer / jitender singh
#include<stdio.h>
#include<conio.h>
Void main()
{
Int r;
Clrscr();
Printf("\n The table of Number Two \n");
for(r=1;r<=10;r++)
{
printf("\n%d",r*2);
}
getch();
}
| Is This Answer Correct ? | 44 Yes | 20 No |
Answer / vaibhav
int i,result;
for(i=1;i<=10;i++)
{
result=i*2;
printf("%d\n",result);
}
| Is This Answer Correct ? | 36 Yes | 26 No |
Answer / mohib ullah orakzai
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a=2,b;
for(int c=1;c<=10;c++)
{
b=a*c;
cout<<a<<"*"<<c<<"="<<b<<endl;
}
getch();
}
| Is This Answer Correct ? | 24 Yes | 15 No |
Answer / laxmi kanth
#include<stdio.h>
main()
{
int a,n;
printf("/nenter the table:\n");
scanf("%d",&a);
for(n=1;n<=10;n++)
printf("\nthe table is:\n%d*%d=%d,a,n,a*n);
}
| Is This Answer Correct ? | 18 Yes | 13 No |
Answer / naresh
#include<stdio.h>
int main(void)
{
int a=2,c;
for(c=1;c<=10;c++)
{
printf("%4d",a*c);
}
return 0;
}
| Is This Answer Correct ? | 12 Yes | 7 No |
Answer / aik expert
<?php
for ($a=0; $a<=10; $a++)
{
$b=$a*3;
echo "3*$a=$b<br>";
}
?>
| Is This Answer Correct ? | 1 Yes | 0 No |
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
main() { signed int bit=512, mBit; { mBit = ~bit; bit = bit & ~bit ; printf("%d %d", bit, mBit); } } a. 0, 0 b. 0, 513 c. 512, 0 d. 0, -513
3 Answers HCL, Logical Computers,
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }
int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().
Is the following code legal? struct a { int x; struct a *b; }
#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }
void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }
What is the hidden bug with the following statement? assert(val++ != 0);
main() { if (!(1&&0)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above
main() { int i=10; i=!i>14; Printf ("i=%d",i); }
void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }
main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }