C program to print a table of any number
#include int main() { int number, i = 1; printf(" Enter the Number:"); scanf("%d", &number); printf("Multiplication table of %d:n ", number); printf("--------------------------n"); while (i
q
#include int main() { int number, i = 1; printf(" Enter the Number:"); scanf("%d", &number); printf("Multiplication table of %d:n ", number); printf("--------------------------n"); while (i
#include #include void main() { int gs,bs,da,ta; clrscr(); printf(“enter basic salary: ”); scanf(“%d”,&bs); da=(10*bs)/100; ta=(12*bs)/100; gs=bs+da+ta; printf(“gross salary=%d”,gs); getch(); } Output: enter basic salary: 100 gross salary=122
#include #include void main() { int n,a,r=0; clrscr(); printf(“enter any no to get its reverse: ”); scanf(“%d”,&n); while(n>=1) { a=n%10; r=r*10+a; n=n/10; } printf(“reverse=%d”,r); getch(); } Output: enter any no…
#include #include void main() { int a,b; clrscr(); printf(“enter value for a & b: ”); scanf(“%d%d”,&a,&b); a=a+b; b=a-b; a=a-b; printf(“after swapping the value of a & b: %d %d”,a,b); getch();…
#include #include void main() { int s1,s2,s3,s4,s5,sum,total=500; float per; clrscr(); printf(“enter marks of 5 subjects: ”); scanf(“%d%d%d%d%d”,&s1,&s2,&s3,&s4,&s5); sum=s1+s2+s3+s4+s5; printf(“sum=%d”,sum); per=(sum*100)/total; printf(“percentage=%f”,per); getch(); } Output: enter marks of 5 subjects: 60…
Logic:Input temperature in centigradeuse formula i.e. fahrenheit = (celsius * 9 / 5) + 32Print the value of fahrenheit #include #include void main() { float c,f; clrscr(); printf(“enter temp in centigrade: ”);…
Formula for finding simple interestsimpleinterest = (principal_amt * time * rate) / 100 #include #include void main() { int p,r,t,si; clrscr(); printf(“enter principle, Rate of interest & time to find…
#include #include void main() { int r; float pi=3.14,area,ci; clrscr(); printf(“enter radius of circle: ”); scanf(“%d”,&r); area=pi*r*r; printf(“area of circle=%f ”,area); ci=2*pi*r; printf(“circumference=%f ”,ci); getch(); } Output: enter radius of…
#include #include void main() { int a,b,s; clrscr(); printf(“Enter two no: ”); scanf(“%d%d",&a,&b); s=a+b; printf(“sum=%d”,s); getch(); } Output: Enter two no: 5 6 sum=11
Below, there are some patterns related to star, number and alphabets that are also asked in interview to test your logic. Some below: