c Programs
c Programs
17.10.2024
1. Calculate a cube of a number with a separate function cube.
PROGRAM:
#include<stdio.h>
int cube(int);
int main(){
int a,b;
printf("enter a number:");
scanf("%d",&a);
b=cube(a);
printf("cube of a given number is:%d",b);
}
OUTPUT:
enter the time: 21
Good night
int main() {
int km, c, m, f, i, s;
switch (c) {
case 1:
m = meter(km);
printf("%d meters\n", m);
break;
case 2:
f = feet(km);
printf("%d feet\n", f);
break;
case 3:
i = inches(km);
printf("%d inches\n", i);
break;
case 4:
s = centi(km);
printf("%d centimeters\n", s);
break;
default:
printf("Enter the correct choice: \n");
break;
}
printf("End\n");
return 0;
}
int main() {
int rows;
printf("Enter the number of rows: ");
scanf("%d", &rows);
pattern(rows);
return 0;
}
PROGRAM:
#include <stdio.h>
int main() {
int n, r;
return 0;
}
OUTPUT:
Enter the value of n: 5
Enter the value of r: 5
C(5, 5) = 1