mhatre.ganesh20

Programming In C Practical 13

Programming In C Practical 13 Question 1 Find sum of digits of a given number using do-while loop. Sum.cpp C #include<stdio.h> #include<conio.h> void main() { clrscr(); int num,rem,sum=0; printf("nEnter a number: "); scanf("%d",&num); do{ rem=num%10; sum=sum+rem; num=num/10; } while(num>0); printf("nSum of digits is: %d",sum); getch(); } #include<stdio.h> #include<conio.h> void main() { clrscr(); int num,rem,sum=0; printf("nEnter […]

Programming In C Practical 13 Read More »

Programming In C Practical 12

Programming In C Practical 12 Question 1 Write a program to check whether the triangle is isosceles, equilateral, scalene or Right-angled triangle. Triangle.cpp C #include<stdio.h> #include<conio.h> void main() { clrscr(); int x,y,z; printf("nEnter three sides of a triangle: "); scanf("%d%d%d",&x,&y,&z); if(x==y&&x==z) printf("nTriangle is equilateral triangle"); else if(x*x==y*y+z*z||y*y==x*x+z*z||z*z==x*x+y*y) printf("nTriangle is right angle triangle"); else if(x==y||y==z||x==z) printf("nTriangle

Programming In C Practical 12 Read More »

Programming In C Practical 11

Programming In C Practical 11 Question 1 Write a C program to print day of the week by taking number from 1 to 7 using switch statement. Days.cpp C #include<stdio.h> #include<conio.h> void main() { clrscr(); int num; printf("nEnter day number: "); scanf("%d",&num); switch(num) { case 1: printf("nIts Monday"); break; case 2: printf("nIts Tuesday"); break; case

Programming In C Practical 11 Read More »

Programming In C Practical 7

Programming In C Practical 7 Question 1 Write a program to find the greatest number between three by using logical operators. Largest.cpp C #include<stdio.h> #include<conio.h> void main() { clrscr(); int num1,num2,num3; printf("nEnter first number: "); scanf("%d",&num1); printf("nEnter second number: "); scanf("%d",&num2); printf("nEnter third number: "); scanf("%d",&num3); if(num1>num2&&num1>num3) { printf("n%d is largest",num1); } if(num2>num1&&num2>num3) { printf("n%d

Programming In C Practical 7 Read More »

Programming In C Practical 6

Programming In C Practical 6 Question 1 Write a program for the largest of three numbers. Largest.cpp C #include<stdio.h> #include<conio.h> void main() { clrscr(); int num1,num2,num3; printf("nEnter first number: "); scanf("%d",&num1); printf("nEnter second number: "); scanf("%d",&num2); printf("nEnter third number: "); scanf("%d",&num3); if(num1>num2) { if(num1>num3) printf("n%d is largest",num1); } if(num2>num1) { if(num2>num3) printf("n%d is largest",num2); }

Programming In C Practical 6 Read More »

Programming In C Practical 5

Programming In C Practical 5 Question 1 Write a C program to read integer, character, float, double values from the user and display it. Mention different format specifiers used in program in comment. values.cpp C #include<stdio.h> #include<conio.h> void main() { clrscr(); int i; char ch; float f; double d; printf("nEnter an integer: "); scanf("%d",&i); printf("nEnter

Programming In C Practical 5 Read More »

Programming In C Practical 4

Programming In C Practical 4 Question 1 Write the output of the following program. program1.cpp C #include<stdio.h> #include<conio.h> void main() { int m=4; float n=m+4.7; printf("%fn",n); printf("%dn",n); getch(); } #include<stdio.h> #include<conio.h> void main() { int m=4; float n=m+4.7; printf("%fn",n); printf("%dn",n); getch(); } Output Question 2 Write the output of the following program. program2.cpp C #include<stdio.h>

Programming In C Practical 4 Read More »