#include<iostream>
void num_to_years_weeks_days(
unsigned num, unsigned& years,
unsigned& weeks, unsigned& days)
{
years = num / 365;
num -= years * 365;
weeks = num / 7;
num -= weeks * 7;
days = num;
}
int main()
{
unsigned years, weeks, days;
unsigned num = 1000;
num_to_years_weeks_days(num, years, weeks, days);
std::cout << num << " days is " << years << " years, " << weeks << " weeks and " << days << " days\n" << std::endl;
num = 12345;
std::cout << num << " days is " << years << " years, " << weeks << " weeks and " << days << " days\n" << std::endl;
}
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
program to extract a given word from a file
write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)
To write a program that inputs a number and displays the digits absent in it, you can follow these steps: Convert the input number into a set of its digits. Create a set of all possible digits (0-9). Subtract the set of digits from the complete set to find the missing ones. Display the missing digits. Here’s a simple example in Python: number = input("Enter a number: ") present_digits = set(number) all_digits = set('0123456789') missing_digits = all_digits - present_digits print("Missing digits:", ''.join(missing_digits))
see pages 43-49 in Principles of Program design by M. A. Jackson, 1975
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
Yes, do write, or if you're too lazy to your homework, use google.
8086 assembly language program to check wether given number is perfect or not
Use the tolower() function. Example: char* a = 'X'; a = tolower(a); printf("%c", a);
program to extract a given word from a file
write a program in C to check whether a given number is apalindrome or not
Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?
It is your face
write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html
write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)
There is no such thing; you seem to have misunderstood something.Any real number can be regarded as a complex number with zero imaginary part, eg.: 5 = 5+0i
To write a program that inputs a number and displays the digits absent in it, you can follow these steps: Convert the input number into a set of its digits. Create a set of all possible digits (0-9). Subtract the set of digits from the complete set to find the missing ones. Display the missing digits. Here’s a simple example in Python: number = input("Enter a number: ") present_digits = set(number) all_digits = set('0123456789') missing_digits = all_digits - present_digits print("Missing digits:", ''.join(missing_digits))