CODE
CODE
#include<conio.h>
int main() {
int n;
clrscr();
scanf("%d",&n);
getch();
return 0;
if (n>=1)
return n*multiplyNumbers(n-1);
else
return 1;
}
2. /* Program to swap two numbers using pointers*/
#include <stdio.h>
#include<conio.h>
int t;
t = *x;
*x = *y;
*y = t;
int main()
int num1,num2;
clrscr();
scanf("%d",&num1);
scanf("%d",&num2);
swap(&num1,&num2);
getch();
return 0;
}
3. //SOLAR SYSTEM
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <dos.h>
#include <math.h>
void planetMotion(int xrad, int yrad, int midx, int midy, int x[60], int y[60]) {
int i, j = 0;
return;
int main() {
err = graphresult();
if (err != grOk) {
/* error occurred */
grapherrormsg(err));
return 0;
midx = getmaxx() / 2;
midy = getmaxy() / 2;
planet[0] = 7;
planet[i] = planet[i - 1] + 1;
pos[i] = i * 6;
}
/* orbits for all 9 planets */
while (!kbhit()) {
/* drawing 9 orbits */
setcolor(WHITE);
setcolor(YELLOW);
setfillstyle(SOLID_FILL, YELLOW);
setcolor(CYAN);
setfillstyle(SOLID_FILL, CYAN);
setcolor(GREEN);
setfillstyle(SOLID_FILL, GREEN);
setcolor(BLUE);
setfillstyle(SOLID_FILL, BLUE);
setcolor(RED);
setfillstyle(SOLID_FILL, RED);
setcolor(BROWN);
setfillstyle(SOLID_FILL, BROWN);
setcolor(LIGHTGRAY);
setfillstyle(SOLID_FILL, LIGHTGRAY);
setcolor(BROWN);
setfillstyle(SOLID_FILL, BROWN);
setcolor(LIGHTBLUE);
setfillstyle(SOLID_FILL, LIGHTBLUE);
setcolor(LIGHTRED);
setfillstyle(SOLID_FILL, LIGHTRED);
if (pos[i] <= 0) {
pos[i] = 59;
} else {
pos[i] = pos[i] - 1;
delay(100);
cleardevice();
closegraph();
return 0;
}
4. //Program To Display Zodiac Sign for Given Date of Birth
#include<stdio.h>
#include<conio.h>
int main()
int m, day;
clrscr();
scanf("%d", &m);
scanf("%d", &day);
else if( (m == 1 && day >= 20) || (m == 2 && day <= 17) )
else if( (m == 2 && day >= 18) || (m == 3 && day <= 19) )
else if( (m == 3 && day >= 20) || (m == 4 && day <= 19) )
else if( (m == 4 && day >= 20) || (m == 5 && day <= 20) )
else if( (m == 5 && day >= 21) || (m == 6 && day <= 20) )
else if( (m == 6 && day >= 21) || (m == 7 && day <= 22) )
else if( (m == 7 && day >= 23) || (m == 8 && day <= 22) )
else if( (m == 8 && day >= 23) || (m == 9 && day <= 22) )
else if( (m == 9 && day >= 23) || (m == 10 && day <= 22) )
{
else if( (m == 10 && day >= 23) || (m == 11 && day <= 21) )
else if( (m == 11 && day >= 22) || (m == 12 && day <= 21) )
else
getch();
return 0;