Showing posts with label number. Show all posts
Showing posts with label number. Show all posts
Monday, February 16, 2015
Java program to convert given number of days into months and days

class Days
{
public static void main(String...s)
{
int n,m,d;
n=Integer.parseInt(s[0]);
m=n/30;
d=n%30;
System.out.println(n+" days"+" = "+m+" months "+"and "+d+" days");
}
}
C program to find cube of a number using macros

Also Read: C++ program to swap two numbers using macros
Also Read: C++ Program to find cube of a number using function
#include<iostream.h>
#include<conio.h>
#define CUBE(x) (x*x*x)
void main()
{
clrscr();
int n,cube;
cout<<"Enter a number:";
cin>>n;
cube=CUBE(n);
cout<<"Cube="<<cube;
getch();
}
Subscribe to:
Posts (Atom)