#include <stdio.h> #include <conio.h> void max(); void min(); int main() { int n; printf(“enter 1 for largest value: \n enter 2 for smallest value “); scanf(“%d”,&n); switch(n) { case 1: max(); break; case 2: min(); break; default: printf(“enter have entered a invalid number”); } } void max() { int a[100],b,c,i,max; printf(“how many number do you […]
#include <stdio.h> #include <stdlib.h> int main() { int a; printf(“Enter the number=”); scanf(“%d”,&a); if(a%2==0){ printf(“The number is Even”); } else{ printf(“The number is Odd”); } return 0; }
#include <stdio.h> #include <stdlib.h> int add(); int main() { add(); return 0; } int add() { int c,d,a,b=1,i; printf(“Enter a number\n”); scanf(“%d”,&a); if(a%2==0){ printf(“The number is even and its factorial cant be calculated\n”); } else{ for(i=1;i<=a;i++){ b=b*i; } printf(“The factorial of a number is %d\n”,b); } }
#include <stdio.h> #include <stdlib.h> int main() { int c,a,b,s; printf(“(A)Enter 1 for + addition.\n”); printf(“(B)Enter 2 for – subtraction.\n”); printf(“(C)Enter 3 for * multiplication.\n”); printf(“(D)Enter 4 for / division.\n”); scanf(“%d”,&c); printf(“Enter the value of a\n”); scanf(“%d”,&a); printf(“Enter the value of b\n”); scanf(“%d”,&b); switch(c){ case 1: s=a+b; printf(“The sum is %d\n”,s); break; case 2: s=a-b; printf(“The […]
#include <stdio.h> #include <stdlib.h> int main() { int i,j; int array[5]; printf(“Enter the marks =\n”); for(i=0;i<5;i=i+1){ scanf(“%d”,&array[i]); } for(j=0;j<5;j++) { printf(“%d”,array[j]); } return 0; }