C program to evaluate the equation y=xn when n is a non-negative integer
#include #include void main() { int count, n; float x,y; printf(“Enter the values of x and n:”); scanf(“%f%d”, &x,&n); y=1.0; count=1; while(count
q
#include #include void main() { int count, n; float x,y; printf(“Enter the values of x and n:”); scanf(“%f%d”, &x,&n); y=1.0; count=1; while(count
#include #include void main() { Enum month(Jan, Feb, Mar, Apr, May, June, July, Aug,Sep, Oct, Nov, Dec) clrscr(); printf(“Jan=%d”, Jan); printf(“Feb=%d”, Feb); printf(“June=%d”, June); printf(“Nov=%d”, Nov); printf(“Dec=%d”, Dec); } Output:…
#include #include #include #include #include void main() { char s[100]; int vow=0,cons=0,spc=0,punc=0,l,i; clrscr(); printf(“enter the statementn”); gets(s); l=strlen(s); for(i=0;i
#include #include void main() { int a[50],b[50],n1,n2,i,x; clrscr(); printf(“enter the number of elements in the first array”); scanf(“%d”,&n1); printf(“enter the elementsn”); for(i=0;i
#include #include void main() { char s1[20],s2[20]; clrscr(); printf(“enter a string: ”); scanf(“%s”,s1); strcpy(s2,s1); strrev(s2); if(strcmp(s1,s2)==0) printf(“string is a palindrome”); else printf(“not a palindrome string”); getch(); } Output: enter a…
#include #include void main() { int n; clrscr(); printf(“enter number: ”); scanf(“%d”,&n); if(n
#include #include void main() { void max(); clrscr(); max(); getch(); } void max() { int a[5],max,n,i; printf(“How many no’s you want to enter: ”); scanf(“%d”,&n); printf(“Enter element for the array:…
#include #include void main() { void table(); clrscr(); table(); getch(); } void table() { int n,i,r; printf(“enter a no to know table: ”); scanf(“%d”,&n); for(i=1;i
#include #include void main() { int a,f; int fact(int); clrscr(); printf(“enter a number: ”); scanf(“%d”,&a); f=fact(a); printf(“factorial= %d”,f); getch(); } int fact(int x) { int fac=1,i; for(i=x;i>=1;i--) fac=fac*i; return(fac); }…
#include #include void main() { void swap(int,int); int a,b,r; clrscr(); printf(“enter value for a&b: ”); scanf(“%d%d”,&a,&b); swap(a,b); getch(); } void swap(int a, int b) { int temp; temp=a; a=b; b=temp;…