Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts
Sunday, May 14, 2017
Algoid – Programming language 1 2 3 APK Android
Algoid – Programming language 1 2 3 APK Android
Staying limber. Drawing whenever I find myself with a span of time where I can sit still. Last February at Union Square, always a target rich environment. Right in front of Cafe Rulli. What more can you ask for? Espresso drink, table and chair. Perfect. I need to get back to it. The next Sketchcrawl is nearly here and Ive not drawn on the sketchbook much because of the crunch in making story reels. We just passed a milestone and its time for a little exhale.
I also draw plants more now. After a trip to the jungle last year where I drew many plants and trees I am now afflicted with a need to keep drawing them. Very relaxing.
Dont forget about our Sketchcrawl event coming up. May 19, 2007, Enrico and I will be meeting everyone in San Francisco, at the Ferry Building at The Embarcadero, 11:00a.m.
See you there.
Available link for download
Wednesday, November 18, 2015
C++ Program to Convert Decimal to Binary in Reversed Form
C++ Program to Convert a Decimal number to its Binary equivalent. The result produced after executing the source code will be in a reversed form.
Also Read: C++ Program to Check If a Character is Small, Capital, Number or Special Character
Also Read: C++ Program For Binary Equivalent Of A Decimal Number
Read more »
Also Read: C++ Program to Check If a Character is Small, Capital, Number or Special Character
C++ Program to Convert Decimal to Binary in Reversed Form
#include <iostream.h>
#include <stdio.h>
int main()
{
int n;
cout<<"enter a decimal number to convert to binary: ";
while (cin >> n)
{
if (n > 0)
{
cout <<"binary equivalent of "<<n<<" in reverse order is: ";
while (n > 0)
{
cout << n%2;
n = n/2;
}
}
else
{
cout << "Please enter a number greater than zero." << endl;
}
}
return 0;
}
Also Read: C++ Program For Binary Equivalent Of A Decimal Number
C++ Program For Binary Equivalent Of A Decimal Number
The c++ program below finds the binary equivalent of an integer entered by the user in decimal form. The binary system often referred to as base two is made of only two digits which are o and 1. The decimal system as the most commonly used number system, has values ranging from 0 to 9. Normally, to convert a binary number to a decimal number, a division is made where the number is divided by 2 and the remainders either o or 1 are read from bottom to top.
Also Read: C++ Program to Compute The Least Common Multiple of Integers
Also Read: C++ Program to Compute The Least Common Multiple of Integers
Also Read: C++ Program to Check If a Number Is A Perfect Number or Not
Read more »
Also Read: C++ Program to Compute The Least Common Multiple of Integers
Also Read: C++ Program to Compute The Least Common Multiple of Integers
C++ Program For Binary Equivalent Of A Decimal Number
#include<iostream.h>
#include <stdio.h>
int main()
{
int n,x,i, j, k;
cout<<"Enter an integer in the decimal number system: ";
cin>>n;
x=n; //assign the value entered for x to n
cout<<"Binary equivalent of the "<<x<<" "<<"is: ";
for( i=1;x!=0;i++)
{
x=x/2;
}
i=i-2;
for (j= i; j>= 0; j--)
{
k = n >> j;
if (k & 1)
cout<<"1";
else
cout<<"0";
}
return 0;
}
Also Read: C++ Program to Check If a Number Is A Perfect Number or Not
Monday, November 16, 2015
BASIC Program to Find Even Numbers Using FOR TO NEXT statement
CLS
Sum = 0
FOR even = 2 T0 50 STEP 2
Sum = Sum + Even
NEXT even
PRINT "The even numbers are:"; Sum
END
Sum is initialised to 0. For variable name (even), Start from 2, step two numbers and stop at 50. This is how the even numbers will be selected. You can choose to print the even numbers to the screen instead of adding them together and assigning it to sum. The program would be
For even = 2 TO 50 STEP 2
Next even
Print "The even numbers are :"; Even
End.
Read more »
Sum = 0
FOR even = 2 T0 50 STEP 2
Sum = Sum + Even
NEXT even
PRINT "The even numbers are:"; Sum
END
Sum is initialised to 0. For variable name (even), Start from 2, step two numbers and stop at 50. This is how the even numbers will be selected. You can choose to print the even numbers to the screen instead of adding them together and assigning it to sum. The program would be
For even = 2 TO 50 STEP 2
Next even
Print "The even numbers are :"; Even
End.
BASIC Program For Sum of Numbers Using IF Then Statement
5 CLS
10 Sum = 0
20 I = 1
30 Input "Enter a Number"; N
40 Sum = Sum + N
50 I = I + 1
60 IF I > 10 Then 80
70 Goto 30
80 Print " The sum is:" Sum
90 End
The first line CLS clears the screen of the previous program that was executed. Sum is initialised to 0. Always advisable to initialise it to 0. 'I' is the counter. You can choose to initialise it to 0 or 1. The keyword 'INPUT' obtains a number from the user by displaying a message 'Enter a number'.
Next line, the counter is incremented, and the compiller moves to the next line and assigns 0 + Entered number to Sum. The 'IF' statement sets a condition and if the condition is true, the program continues to line 80, if the condition is false, that is the counter is below ten, it goes back to line 30 requesting another number from the user.
The condition must be satisfied before the program prints the result to the screen.
Read more »
10 Sum = 0
20 I = 1
30 Input "Enter a Number"; N
40 Sum = Sum + N
50 I = I + 1
60 IF I > 10 Then 80
70 Goto 30
80 Print " The sum is:" Sum
90 End
The first line CLS clears the screen of the previous program that was executed. Sum is initialised to 0. Always advisable to initialise it to 0. 'I' is the counter. You can choose to initialise it to 0 or 1. The keyword 'INPUT' obtains a number from the user by displaying a message 'Enter a number'.
Next line, the counter is incremented, and the compiller moves to the next line and assigns 0 + Entered number to Sum. The 'IF' statement sets a condition and if the condition is true, the program continues to line 80, if the condition is false, that is the counter is below ten, it goes back to line 30 requesting another number from the user.
The condition must be satisfied before the program prints the result to the screen.
Thursday, November 12, 2015
C++ Program to Find Prime Number Or Not
This c++ program checks if a number is a prime or not. A number which is greater than 1 and can only be divided by 1 and itself are prime numbers. These prime numbers include 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 and so on. A FOR loop is implemented in this program. If the number entered by the user can be divided by another number that is within its range to give zero as the remainder then, this number is not a prime number.
Read more »
#include <iostream.h>
#include <math.h>
void main()
{
int num, a=0;
cout<<"enter a number: ";
cin>>num;
for(int i=2;i<num;i++)//loop begins at 2 since 1 can divide any number
{
if(num%i==0)
{
a++;
}
}
if(a==0)
{
cout<<num<<" is a prime number";
}
else
cout<<num<<"is not a prime";
}
Wednesday, November 11, 2015
C++ Program to Compute The Least Common Multiple of Integers
C++ program to compute the LCM of two numbers. Least Common Multiple can be gotten by dividing the numbers by their common factors.Using the logic below, we can also find write a program to calculate the LCM for more numbers.
Read more »
//C++ program that computes the least common multiple of two integers. These are represented as a and b below.
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,i,j; //Variable declarations
clrscr;
cout<<"enter a number: ";
cin>>a;
cout<<"enter a number: ";
cin>>b;
i=a ;
j=b;
if(a==0||b==0) //Checks if either a OR b is 0
cout<<" The LCM is 0"; //If 0 from the condition above, a display message is output to the screen
else
{
while(a!=b)//While the value of a is not equal to b execute the statements below
{
if(a>b)
b=b+j;
else
if(a<b)
a=a+i;
}
cout<<"LCM:"<<" "<<a;
}
}
C++ Program to Compare The Greatest Of Three Integers
C++ program to compare which is the greatest among three numbers. An IF statement is used to set the condition to know which is less or greater than which.
Read more »
#include<iostream.h>
#include<math.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
cout<<"enter the first value";
cin>>a;
cout<<"enter the second value";
cin>>b;
cout<<"enter the third value";
cin>>c;
if (a>b&&b>c)
cout<<"The greatest is: "<<a;
else
if(a<b&&b>c)
cout<<"The greatest is: "<<b;
else
if(a<b&&b<c)
cout<<"The greatest is: "<<c;
else
if(a==b&&b==c)
cout<<"Non is greater!!";
}
Wednesday, November 4, 2015
C++ Program To Calculate The Average For 10 Students In 5 Courses
Computer science program using C++ language to calculate the sum and average of 10 students in 5 different courses. Note that c++ is case sensitive. There are two loops in this program. The first loop to read in the names of 10 students and the second loop which is within the first loop is to read in the scores in each courses. The first loop is incremented when the second inner loop is completed.
Tracing through the program we have the predecessor directives, next is declarations. The identifer 'nos' specifies the number of students. Then 'noc' the number of courses. 'Score' is declared as an array, while 'sum' and 'ave' as integers.
Read more »
Tracing through the program we have the predecessor directives, next is declarations. The identifer 'nos' specifies the number of students. Then 'noc' the number of courses. 'Score' is declared as an array, while 'sum' and 'ave' as integers.
#include <iostream.h>
#include <conio.h>
void main ()
{
const int nos=10;
const int noc=5;
char name [nos];
float scores [nos][noc];
float sum[nos], ave[nos];
int i,j;
for (i=1;i<nos; i++)
{
cout<<"Enter name of student: "<<i<<endl;
cin>>name;
for(j=1;j<=noc;j++)
{
cout<<" enter the score: "<<j<<endl;
cin>> score[i][j];
sum[i]=score[i][j];
}
ave[i]=sum[i]/5;
cout<<"Average Score For"<<" "name<<" "<<ave[i]<<endl;
}
}
Labels:
C++,
Computer Programming,
Programming
Tuesday, November 3, 2015
C Program To Create Records
The program below holds the name and earnings of an employee. A loop is set for only three employees. You can specify any number of persons in your program.
The predecessor directives come first, one to aid 'clrscr' in the program. Basic rule of c++ programming.
The records will be stored in a structure called 'struct gra'. Declarations are made within this structure. These are 'count' and 'earn' being declared as integers. So is 'name' declared as a character 'char' with the number of characters or letters it should allow [30].
The number of employees this program will hold is assigned in the loop. The next loop after void main program sets a 'start value i=0', 'end value i<3' and 'incrementer i++'. Within the first loop, the records are read in (With scanf, %d meaning the input from the user will be an integer) with a message prompting for input from the user. And within the second loop the result is displayed. Some codes like "\n" from the program means a new line. Also "getch()" helps output our result to the screen. This program is written in c language and can easily be rewritten in c++
Read more »
The predecessor directives come first, one to aid 'clrscr' in the program. Basic rule of c++ programming.
The records will be stored in a structure called 'struct gra'. Declarations are made within this structure. These are 'count' and 'earn' being declared as integers. So is 'name' declared as a character 'char' with the number of characters or letters it should allow [30].
The number of employees this program will hold is assigned in the loop. The next loop after void main program sets a 'start value i=0', 'end value i<3' and 'incrementer i++'. Within the first loop, the records are read in (With scanf, %d meaning the input from the user will be an integer) with a message prompting for input from the user. And within the second loop the result is displayed. Some codes like "\n" from the program means a new line. Also "getch()" helps output our result to the screen. This program is written in c language and can easily be rewritten in c++
#include <conio.h>
#include<stdio.h>
struct gra
{
int count, earn;
char name[30];
}
loop[3];
void main()
{
clrscr;
for (int i=0;i<3;i++)
{
printf("Enter the employee number: ");
scanf("%d",&loop[i].count);
printf("\nEnter Employees's name: ");
scanf("%s",&loop[i].name);
printf("\nEnter the earnings: ");
scanf("%d",&loop[i].earn);
}
for (i=0;i<3;i++)
{
printf("%4d",loop[i].count);
printf("%8s",loop[i].name);
printf("%4d",loop[i].earn);
}
getch();
}
Labels:
C++,
Computer Programming,
Programming
Sunday, November 1, 2015
C++ Program to Check If a Character is Small, Capital, Number or Special Character
The C++ Program checks if the value entered by a user is a capital, small, number or a special character. The output also returns the Ascii equivalent of the character. IF statement is used for flow of control in the program.
Also Read: C++ Program to Check If a Number Is A Perfect Number or NOt
C++ Program to Find All The Roots Of A Quadratic Equation
C++ Program to Compute The Least Common Multiple of Integers
Read more »
Also Read: C++ Program to Check If a Number Is A Perfect Number or NOt
C++ Program to Find All The Roots Of A Quadratic Equation
C++ Program to Compute The Least Common Multiple of Integers
#include <iostream.h>
int main()
{
char alphabet;
cout<<"enter an character: ";
cin>>alphabet;
int Ascii=alphabet;
if (Ascii>=97 && Ascii<=122)
{
cout<<"the Ascii equivalent of "<<alphabet<<" is: "<<Ascii<<endl;
cout<<"alpabet is a small letter";
}
else if (Ascii>=65 && Ascii<=90)
{
cout<<"the Ascii equivalent of "<<alphabet<<" is:" <<Ascii<<endl;
cout<<"The alphabet is a capital letter";
else if (Ascii>=47 && Ascii<=57)
{
cout<<"the Ascii equivalent of "<<alphabet<<"is: "<<Ascii<<endl;
cout<<"You entered a number";
}
else if (Ascii>=0 && Ascii>=47 || Ascii>=54 && Ascii<=64 || Ascii>=91 && Ascii<=96 || Ascii >=123 && Ascii<=127)
{
cout<<"the Ascii equivalent of "<<alphabet<<"is:"<<Ascii<<endl;
cout<<"you entered a special character";
}
return 0;
}
Subscribe to:
Posts (Atom)
