Once I was just anyhow wanted to learn tables till 25 to quicken up my calculations, so I wrote this piece of code in C++. I already knew till 10, so I skipped.
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
int i,j,ans;
cout<<"Welcome to TABLE learning....!!!!\n\n";
while(1)
{
i=rand()%15+10;
j=rand()%9+2;
cout<<i<<" x "<<j<<" = ";
cin>>ans;
if(ans==i*j)
cout<<"good..\n\n";
else
cout<<"ans is ... "<<i*j<<" try again...!!!\n\n";
}
getch();
return 0;
}
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
int i,j,ans;
cout<<"Welcome to TABLE learning....!!!!\n\n";
while(1)
{
i=rand()%15+10;
j=rand()%9+2;
cout<<i<<" x "<<j<<" = ";
cin>>ans;
if(ans==i*j)
cout<<"good..\n\n";
else
cout<<"ans is ... "<<i*j<<" try again...!!!\n\n";
}
getch();
return 0;
}
No comments:
Post a Comment