In python 3 I would write the following (assuming the digits are input by a user):
#!/usr/bin/python
a = input("Type a number: ")
sum = 0
for i in a: #the for next loop performs the function of a while loop with less lines of code.
#(My formating keeps getting deleted when I publish this answer. There should always be a tab- strictly speaking four spaces before this line) sum = sum + int(i)
sum = str(sum)
print("Your number was", a + ". The sum of its digits is" , sum + ".")
As you can see, the for next loop iterates through each value in the string "a", and sets its value to "i". For each iteration, the current value of i is added to the variable "sum" until the end of the number is reached. The program then prints the original number, and the sum of its digits.
sdfdg
how can we print without using semi coloum semi coloum ina c program is used to indicate the end of a line......without ; at end the compiler cannot proceed to next step
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
Use the option File / Print in the program you are using.
If you forget the semicolon, your program won't compile.
impossible sorry
Quick Print enables you to print without using the Print dialog box. If you just want to do a standard print, without changing settings then using the Quick Print saves some time.
You can't. A printer is necessary to print pictures.
1023459
To frame a print without using glass, you can consider using alternative materials such as acrylic, plexiglass, or UV-protective coatings. These options can provide protection for the print while avoiding the use of traditional glass.
Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.
Yes but why.