I have been a regular visitor of IMDB for over three years,and as far as I can remember, Godfather ruled the charts.But there is this new upstart called The Dark Knight,a Batman movie that has made a stellar climb to the top of the chart.Running in theatres for just 4 days it has managed to garner 23 thousand-odd votes and get a whooping score of 9.5! But,as I have pointed out to my friends,I will wait for another 3 weeks and see whether it has maintained that top position.Things including opinions can change.
I wrote something about a funny program yesterday,and the program sent by friend Sriram was nevertheless good,but I would say it lacked efficiency.So I thought of a way the computer would be made to do less calculations and improve the speed;my idea was to reduce the number of iterations by avoiding the procedure of checking each and every four digit number for the condition.Instead the program could check if the second digit was greater than the first,then only move on.Likewise using nested for loops the program's efficiency could be improved.Here's the program I wrote:
#include
#include
void main()
{
int n1,n2,n3,n4,count=0;
clrscr();
for(n1=1;n1<=9;n1++)
for(n2=(n1+1);n2<=9;n2++)
for(n3=0;n3
for(n4=(n3+1);n4<=9;n4++)
{printf("%d%d%d%d\n",n1,n2,n3,n4);count++;}
printf("Count = %d",count);
getch();
}
Ahem!
I have been attending C# classes for a week now..The class hasn't come to the part where the language displays its advancements from its predecessors.Till now we have been learning the C# counterparts of classes,print statements,etc.So you can say it's no too interesting at the moment thought I am sure it will be in another couple of weeks(but there's another reason why I never miss class :-D ) Anyway,I thought of a program while I was in class-a simple one rather,but my point was that the program should be efficiently done as possible.The program should print all four digit numbers whose second digit was greater than the first and third digits;the fourth digit should be greater than the third.My bud Sriram wrote the program.You can check it out here.