better study for exams dude, ur placement depends on marks.a_k_s_h_a_y said:yeah that's what i meant
a program can be written in many ways !!
he wants us to think exactly as he does !
that can be done using basics of printf thing ... going back and coming forward .. but now who has time to solve it .. exams are on !!
exceptions do occurThe_Devil_Himself said:who said placement depends upon marks?toppers sux and are good for nothing!The guy who got the highest placement in my university in 2005-2006 had 9 backs at the time of interviews!!
yeah! u r right! few girls who r topper in my class knows nothin abt programin!! jst mug up the things! but at least 1 need the grace marks for sittin in placement exams!!!The_Devil_Himself said:who said placement depends upon marks?toppers sux and are good for nothing!The guy who got the highest placement in my university in 2005-2006 had 9 backs at the time of interviews!!
no a_k_s_h_a_y my intension is not that..a_k_s_h_a_y said:yeah that's what i meant
a program can be written in many ways !!
he wants us to think exactly as he does !
this is some what trueanantkhaitan said:Perhaps he is making the rules after seeing my code
don't give up anantkhaitan. the answer to this puzzle is way too easy..anantkhaitan said:@ adi
Listen brother i have just one thing to say "I GIVE UP".
i already told that tom should chase jerry for 2 lines...anantkhaitan said:If we use something like while(!kbhit()) the loop keeps on iterating until you press a key i.e. ending up your program whenever you like,
^^I agree with u ..The_Devil_Himself said:who said placement depends upon marks?toppers sux and are good for nothing!The guy who got the highest placement in my university in 2005-2006 had 9 backs at the time of interviews!!
+100The_Devil_Himself said:who said placement depends upon marks?toppers sux and are good for nothing!The guy who got the highest placement in my university in 2005-2006 had 9 backs at the time of interviews!!
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,j=1;
long k;
char a[]="Tom# Jerry ";
clrscr();
while(j<=2)
{
for(i=0;i<=149;i++)
{
printf("%*s",i+strlen(a),a);
for(k=0;k<9999999;k++);
clrscr();
}
a[3]=' ';a[10]='#';
for(i=149;i>=0;i--)
{
printf("%*s",i+strlen(a),a);
for(k=0;k<9999999;k++);
clrscr();
}
a[3]='#';a[10]=' ';
j++;
}
}
11th puzzle added!!adi007 said:Hi! I am Adithya U,17 year old Engineering Student(IT) from Hassan,Karnataka
*farm3.static.flickr.com/2052/2086499468_1f153310e7_o.gif
Currently you are witnessing C puzzle 11
First,let me state the rules in this thread:
1.Please do not give suggestions or hints.Specify the modified program only.
2.Before posting the program make sure it's working in the way i want.
Here is the 11th C puzzle
write a c program which gives the output as below..
Code:Enter a number 52 The reverse of 52 is 25 52 is not a prime number Sum of digits=7
Code:Enter a number 17 The reverse of 17 is 71 17 is a prime number Sum of digits=8
If i didn't specify the rules then anyone can solve this
Rules
maximum of 2 header files
maximum 2 variables(including global and local variables)
Both the variables must be of same data type
no structures,pointers,user defined functions..
Note :Specify your modified program along with the answer
Awards gallary:
Total puzzles solved :10
anuj919 3
me (If no one gets the solution then points will be for me) 2
saurabh kakkar 2
fun2sh 2
eggman 1
nigthtcrawler 1
a_k_s_h_a_y 1
anantkhaitan 1
Leading:anuj919
#include<stdio.h>
int main()
{
int a,b;
printf("Enter a Number\n");
scanf("%d",&a);
b=10*(a%10)+(a/10);
printf("The reverse of %d is %d\n",a,b);
for(b=2;b<=a;b++)
if(a==b)
{printf("%d is a prime number\n",a);break;}
else if(a%b==0)
{printf("%d is not a prime number\n",a);break;}
printf("Sum of digits=%d\n",a/10+a%10);
return 0;
}
#include<stdio.h>
#include<conio.h>
void main(void){
int n,i;
clrscr();
printf("Enter a number\n");
scanf("%d",&n);
printf("The reverse of %d is ",n);
i=n;
while(i>0){
printf("%d",i%10);
i/=10;
}
printf("\n%d is ",n);
for(i=2;i<n;i++)
if (n%2==0){
printf("not ");
break;
}
printf ("a prime number",n);
i=0;
while(n>0){
i+=n%10;
n/=10;
}
printf("\nSum of digits=%d",i);
getch();
}