UrgentHomeWork

+1-617-874-1011 (US)
+44-117-230-1145 (UK)
+61-7-5641-0117 (AU)
help@urgenthomework.com
Live chat

Available 24 x 7 Assignment Help

With Tutoring

# C Homework help

## Order of precedence

Following is the order of precedence in C:

High priority operators are evaluated before lower priority ones. Operators of the same priority are evaluated from left to right

{/* Sample C program to illustrate concepts described above */}
#include <stdio.h>
#include <conio.h>
int main()
{
{//}int a, ans1, ans2;
float b, ans3, ans4;
char c;
printf(“Enter an integer, a=”);
scanf(“%d”,&a);
printf(“\nEnter a float, b=”);
scanf(“%f”,&b);
printf(“\nEnter a char, c=”);
scanf(“%c”,c);
ans1 = a + b * c;
ans2 = a + b – c;
ans3 = a * b – c;
ans4 = a – b + c;
printf(“\nans1 = %d\nans2 = %d\nans3 = %-f\nans4 = %-f”,ans1,ans2,ans3,ans4);
getch();
return;
}

In this program we are performing Mathematical Operation on a char, what will happen?
It won’t give any error rather it will take the ASCII value of that char and will perform operation on that.
You might get some problems with scanf in case of char, with some compilers. There are other methods to get that done which we will discuss later.

## Topics in C Programming

Resources
24 x 7 Availability.
Trained and Certified Experts.
Plagiarism Free.
Privacy Guaranteed.