C programming tutorials. Giving you solutions of all programs since launched, if there i any problem missing you can also mail us or tweet us.
Tuesday, 28 October 2014
Adding all digit of a Given Number in C
Input = 123456
output = 21 //(1+2+3+4+5+6)
To add all digits of number we will simply write a loop and just take the last digit from the given number and remove one digit from the given number. The loop will continues till the number is greater than 0.
To do this we will use the while loop.
output = 21 //(1+2+3+4+5+6)
To add all digits of number we will simply write a loop and just take the last digit from the given number and remove one digit from the given number. The loop will continues till the number is greater than 0.
To do this we will use the while loop.
How To Enter A Number And Reverse it in C
Input - 123456
Output - 654321
#include<stdio.h>
void main()
{
Saturday, 4 October 2014
Adding two Numbers
To add two numbers we will simply just create three variables, two for the numbers and one for the result. See example
int main()
Creating Variables & Data types
Variables
Constant are the term that can not be changed at the time of program execution some time we need to change the value of variable so we use variables in this condition.
Variables are nothing just given name to the particular space of our memory.
Variables are nothing just given name to the particular space of our memory.
Wednesday, 1 October 2014
Subscribe to:
Comments (Atom)
