Using string functions write a program that will accept the
name of the capital as input value and will display the
corresponding country.
------------------------
Capitals Countries
------------------------
Capitals Countries
Ottawa Canada
Moscow Russia
Rome Italy
I can't not get it to run properly
Answer / roxy
this is my code:
#include<stdio.h>
#include<string.h>
main()
{
char cc1[]={"OTTAWA"},
{"MOSCOW"},
{"ROME"};
char cc2[]={"CANADA"}
{"RUSSIA"}
{"ITALY"};
char a;
clrscr();
printf("Enter Capital: ");
scanf("%s",&cc1);
a=strcmpi(cc1,cc2);
strncpy(cc2,cc1,[1]);
if(a==0)
{
printf("\nThe capital of %s is %s",cc1,cc2);
}
if(a==1)
{
printf("\nThe capital of %s is %s",cc1,cc2);
}
else(a==2)
printf("\nThe capital of %s is %s",cc1,cc2);
getch()
}
| Is This Answer Correct ? | 13 Yes | 84 No |
void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?..
32 Answers College School Exams Tests, CTS, HCL, iGate, SmartData,
2. A student studying Information Technology at Polytechnic of Namibia is examined by coursework and written examination. Both components of assessment carry a maximum of 50 marks. The following rules are used by examiners in order to pass or fail students. a. A student must score a total of 40% or more in order to pass (total = coursework marks + examination marks) b. A total mark of 39% is moderated to 40% c. Each component must be passed with a minimum mark of 20/50. If a student scores a total of 40% or more but does not achieve the minimum mark in either component he/she is given a technical fail of 39% (this mark is not moderated to 40%) d. Grades are awarded on marks that fall into the following categories. Mark 100-70 69-60 59-50 49-40 39-0 Grade A B C D E Write a program to input the marks for both components (coursework marks out of 50 and examination marks out of 50), out put the final mark and grade after any moderation. [30]
loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program.
write a profram for selection sort whats the error in it?
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .
how to convert decimal to hexadecimal without using arrays just loops
#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }
which typw of errors ? & how to solve it ?
Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL
What is the code for following o/p * * * * * * * * * * * * * * * *
Using string functions write a program that will accept the name of the capital as input value and will display the corresponding country. ------------------------ Capitals Countries ------------------------ Capitals Countries Ottawa Canada Moscow Russia Rome Italy I can't not get it to run properly
How to develop a program using C language to convert 8-bit binary values to decimals. TQ